diff --git a/voussoir.net/writing/vmarkdown.py b/voussoir.net/writing/vmarkdown.py index 8238d37..230fd52 100644 --- a/voussoir.net/writing/vmarkdown.py +++ b/voussoir.net/writing/vmarkdown.py @@ -130,10 +130,13 @@ class VoussoirInlineGrammar(mistune.InlineGrammar): footnote_text = re.compile(r'\[footnote_text\]') subreddit = re.compile(r'\/r\/[A-Za-z0-9_]+') redditor = re.compile(r'\/u\/[A-Za-z0-9_]+') + dash_spacer = re.compile(r'^\s*-$', re.MULTILINE) # This `text` override is based on this article: # https://ana-balica.github.io/2015/12/21/mistune-custom-lexers-we-are-going-deeper/ # in which we have to keep adding characters to the recognized list every - # time we make a new rule. My additions so far are \- and \^. + # time we make a new rule. My additions so far are: + # \- for -- + # \^ for superscript text = re.compile(r'^[\s\S]+?(?=[\\{m.group(0)}' + def output_dash_spacer(self, m): + return '' + class VoussoirBlockGrammar(mistune.BlockGrammar): - dash_spacer = re.compile(r'^-$', re.MULTILINE) + # The single hyphen is used to create a split between elements that + # would normally merge together, such as block quotes. + dash_spacer = re.compile(r'^\s*-$', re.MULTILINE) class VoussoirBlock(mistune.BlockLexer): default_rules = copy.copy(mistune.BlockLexer.default_rules)