Escape square brackets, braces and at characters in text nodes (fixes #4) #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As @Niols pointes out in #4,
None of these characters have any special meaning by themselves in Markdown. Square brackets only have a special meaning in the
[<link text>](<link address>)
syntax, and in that case Omd returns anOmd.Link
node so they don't appear in the text. The only case when they can appear and need escaping isOmd.Text
.One peculiarity of current Omd versions is that insignificant square brackets still force it emit a text node, so any text with anything in square brackets will produce three nodes instead of one. It doesn't change escaping logic, however.
With my patch it seems to behave as expected:
(Stdin reading support is from #8)