What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

In the post below, Jeff Atwood claimed the MarkdownSharp has changed Markdown rules to disable intra-word emphasis like "the_file_name" or "file_one and file_two".
http://www.codinghorror.com/blog/2009/12/responsible-open-source-code-parenting.html

As a result, the two components at both ends of the regular expressions, only match non-word character. That just what \W means:
https://code.google.com/p/markdownsharp/source/browse/MarkdownSharp/Markdown.cs#1357

Of course, Pagedown also do the same.

However, in East Asian Scripts, any emphasises are always "intra-word"! For example, this line with Markdown notations meant to emphasis two words, "北京" and "上海", that only are separated by the "和":

**北京**和**上海**是直辖市。

It's very common uses in Chinese. But now, if we want get the "intra-word emphasis" effect,

北京上海是直辖市。

we would have writing like this:

<strong>北京</strong>和<strong>上海</strong>是直辖市。

So, we have revised the searched regular expressions in MarkdownSharp and Pagedown to (C#):

([\W_]|\u4e00-\u9fff|^) (\*\*|__) (?=\S) ([^\r]*?\S[\*_]*) \2 (?=[\W_]|\u4e00-\u9fff|$)

and (JavaScript)

/([\W_]|\u4e00-\u9fff|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2(?=[\W_]|\u4e00-\u9fff|$)/g

the replaced patterns to (both server-side and client-side):

$1<em>$3</em>

截止2013年5月16日,下面的格式在图灵社区会原样不变:

*_北京_*和*_上海_*是直辖市。_*北京*_和_*上海*_是直辖市。

但应该显示为(与StackOverflow一致的):

*北京*和*上海*是直辖市。_北京_和_上海_是直辖市。


关于杨帆提出的两个问题的疑惑

2013年5月27日,杨帆提到以下文本中的“站点”在图灵社区曾经可以显示为粗体:

由Web*站点*构成

如上所示,Stack Overflow网页展示的“站点”不是粗体(客户端预览也不是)——这倒没关系——关键是,据温谦老师说:

(图灵社区)现在禁止(词内强调)时,使用的正则表达式(是):"([^A-Za-z0-9]||^) (*|) (?=\S) ([^\r*_]*?\S) \2 ([^A-Za-z0-9]|_|$)"
——出处:http://www.ituring.com.cn/article/38840#reply-19633

这个正则表达式要求匹配[^A-Za-z0-9],所以杨帆说的“站点”曾经可以显示为粗体的情况不可能出现!因为“Web”中的“b”不会与这个组件匹配,双星号也就不会被替换成<strong>标签。这是一个疑惑。

2013年4月23日,杨帆还提到以下文本中的Y、A、C、C在图灵社区预览不正确,但结果正确!

顺便说一下“yacc”这个名字的由来是*Y*et *A*nother *C*ompiler *C*ompiler的缩写。

Stack Overflow禁用这种“词内强调”,图灵社区好像从一开始都在遵照这个“惯例”吧?如果是,怎么会出现“结果正确”这种违反惯例的情况呢?这是第二个疑惑。

2013-05-27 pm16:34 李松峰

share|improve this question
5  
’Tisn’t really a bug if you’re not expecting Chinese text — like on Stack Overflow. Or is this just a bug report for the library? –  minitech May 2 '13 at 2:07
    
Yes, it isn't a bug. –  Li Songfeng May 3 '13 at 2:05
4  
instead of <strong></strong> you could just use <b></b> which saves 10 letters. –  Doorknob May 7 '13 at 1:36
8  
@rynah It is an issue on some of the other SE sites, like the Japanese and Chinese sites. (Unsure if it also applies to Russian or other non-latin alphabet language sites.) –  Troyen May 16 '13 at 6:14
1  

You must log in to answer this question.

Browse other questions tagged .