1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:27:35 +00:00

LibMarkdown: Handle delimiter flanking with punctuation

This patch handles the following two rules
1) A delimiter run is either (a) not followed by a Unicode punctuation
   character, or (b) followed by a Unicode punctuation character and
   preceded by Unicode whitespace or a Unicode punctuation character.

2) A _ can be used to open/close a delimiter run if it's (a) not part
   of a left-flanking delimiter run or (b) part of a left-flanking
   delimiter run followed by a Unicode punctuation character.
This commit is contained in:
Peter Elliott 2021-09-09 23:22:07 -06:00 committed by Andreas Kling
parent d28459fb11
commit af5a07399e
2 changed files with 41 additions and 14 deletions

View file

@ -111,6 +111,8 @@ private:
// definition, see the CommonMark spec.
bool left_flanking;
bool right_flanking;
bool punct_before;
bool punct_after;
// is_run indicates that this token is a 'delimiter run'. A delimiter
// run occurs when several of the same sytactical character ('`', '_',
// or '*') occur in a row.