L
Lloyd Zusman
I have discovered that in the latest release of BlueCloth, it's
impossible to render 2-character words in either bold or italic.
I looked through the source code, and I found the reason why:
# Pattern to match strong emphasis in Markdown text
BoldRegexp = %r{ (\*\*|__) (\S|\S.+?\S) \1 }x
# Pattern to match normal emphasis in Markdown text
ItalicRegexp = %r{ (\*|_) (\S|\S.+?\S) \1 }x
Notice that the regexps only match strings that are either 1 character
long or at least 3 characters long. To fix this, I believe that the
code needs to be changed as follows:
# Pattern to match strong emphasis in Markdown text
BoldRegexp = %r{ (\*\*|__) (\S|\S.*?\S) \1 }x
# Pattern to match normal emphasis in Markdown text
ItalicRegexp = %r{ (\*|_) (\S|\S.*?\S) \1 }x
(I replaced ".+?" with ".*?")
Is there any reason for why this change shouldn't be made? If so, is
there another way to get BlueCloth to render 2-character words in bold
or italics?
Thanks in advance.
impossible to render 2-character words in either bold or italic.
I looked through the source code, and I found the reason why:
# Pattern to match strong emphasis in Markdown text
BoldRegexp = %r{ (\*\*|__) (\S|\S.+?\S) \1 }x
# Pattern to match normal emphasis in Markdown text
ItalicRegexp = %r{ (\*|_) (\S|\S.+?\S) \1 }x
Notice that the regexps only match strings that are either 1 character
long or at least 3 characters long. To fix this, I believe that the
code needs to be changed as follows:
# Pattern to match strong emphasis in Markdown text
BoldRegexp = %r{ (\*\*|__) (\S|\S.*?\S) \1 }x
# Pattern to match normal emphasis in Markdown text
ItalicRegexp = %r{ (\*|_) (\S|\S.*?\S) \1 }x
(I replaced ".+?" with ".*?")
Is there any reason for why this change shouldn't be made? If so, is
there another way to get BlueCloth to render 2-character words in bold
or italics?
Thanks in advance.