Conversation
|
jeremy-rifkin
left a comment
There was a problem hiding this comment.
Thanks for looking into this, the changes here look good to me. A few quick comments below.
Separately, I have put together a proper discord markdown parser for uses elsewhere in the bot and I'm starting to integrate that. At some point it might make sense to try to use that for the wiki code too.
| after_escape = true; | ||
| } else if (c === "`") { | ||
| result += this.substitute_placeholders_no_code(piece); | ||
| const end_of_inline_code = index_of_first_unescaped(line, "`", i + 1); |
There was a problem hiding this comment.
I don't know of any markdown dialects that let you escape \ within code. Github and discord don't so I don't think this is something we should try to support.
| if (end_of_inline_code === null) { | ||
| return result + line.substring(i); | ||
| } |
There was a problem hiding this comment.
If a ` is unterminated generally it'd make sense to continue substituting through the rest of the string
| * - the `result` string (may be empty string) of the substitution, and | ||
| * - the `consumed_length` within the original string (may be zero). | ||
| */ | ||
| private substitute_placeholders_in_link_mask(line: string, start: number) { |
There was a problem hiding this comment.
It's unfortunate to need this but understandable
|
Converting to draft |
66f9f51 to
983d740
Compare



Prerequisite for: TCCPP/wiki-articles#17
In essence, this PR makes the
ArticleParserfully aware of masked link syntax. This is absolutely necessary to have reference-style masked links around code blocks. The current approach is to simply partition a line like... into pieces, separated by backticks for inline code. This is broken because the last part of the line is
][ref], which is not recognized as a masked link.Additionally, this PR makes it possible to add "self-contained reference-stye links", i.e.
[mask], which is equivalent to[mask][mask].