You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The verbatim extension registers the character \ as a special inline character with cmark-gfm so that we can detect the string \verbatim in a comment.
However, this breaks cmark-gfm as \ is added to the (global) SPECIAL_CHARS table when inlines are processed. When the processing is complete, it is removed from that table again. This seems wrong in several ways:
Also single-threaded, there are problems. Removing \ from SPECIAL_CHARS seems to be wrong, since it is a special character anyway (the escape character). Parsing a comment without the verbatim-extension now breaks detection of escapes, e.g., \`code\` understands the first escape correctly (since parse_inline() does not use the SPECIAL_CHARS table) but misses the second escape. (This is now cmark_syntax_extension_set_special_inline_chars removes standard special chars github/cmark-gfm#221.)
Without changing cmark-gfm, there's not much that standardese can do about this.
It's probably best to replace the \verbatim syntax with something that can be safely parsed such as `verbatim:…`. This won't work inside backticks but inside backticks we probably do not need verbatim anyway.
saraedum
added
bug
upstream
The issue is caused by a dependency. It's been reported upstream and we are waiting for a release.
labels
Apr 26, 2021
saraedum
changed the title
race condition in verbatim extension
race in verbatim extension
Apr 26, 2021
The verbatim extension registers the character
\
as a special inline character with cmark-gfm so that we can detect the string\verbatim
in a comment.However, this breaks cmark-gfm as
\
is added to the (global)SPECIAL_CHARS
table when inlines are processed. When the processing is complete, it is removed from that table again. This seems wrong in several ways:Having
SPECIAL_CHARS
in a global table means that cmark-gfm cannot be used in a multi-threaded environment it appears. (Fixed in Made cmark re-entrant by storing special chars data per parser object github/cmark-gfm#176)Also single-threaded, there are problems. Removing
\
fromSPECIAL_CHARS
seems to be wrong, since it is a special character anyway (the escape character). Parsing a comment without the verbatim-extension now breaks detection of escapes, e.g.,\`code\`
understands the first escape correctly (sinceparse_inline()
does not use theSPECIAL_CHARS
table) but misses the second escape. (This is now cmark_syntax_extension_set_special_inline_chars removes standard special chars github/cmark-gfm#221.)Btw., the way parsing works in
cmark-gfm
means that\verbatim
cannot work wheneverparse_inline()
is called, e.g., at the beginning of a block since extensions are only checked after all the standard control characters have been handled.The text was updated successfully, but these errors were encountered: