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
Backslash: the Markdown standard library also seems to parse the backslashes, although they just end up being separate text nodes with \ content, so we can convert those:
LineBreak: I had forgotten that the Markdown standard library also has Markdown.LineBreak, and so does cmark, so we should definitely implement this.
SoftBreak: the Markdown standard library doesn't implement this and just converts it to a space instead:
julia> md"""
foo
bar
""".content
1-element Vector{Any}:
Markdown.Paragraph(Any["foo bar"])
So when converting to and from that we'll lose some information. cmark, however, does have a node for this.
I wonder how to handle Text() elements that contain newlines and backlashes, however. It seems that for backslashes, we can anyway end up with literal backslashes in the text, but the cases where it resembles a escape sequence could be problematic. Similarly, newlines in the text could be a problem.
One option would be disallow these characters when constructing Text(). Otherwise, the consumers have to assume that the nodes can contain weird backlashes and newlines.
However, this would be annoying when constructing trees programmatically (as opposed to parsing Markdown). To work around that, we could provide e.g. an inlinetext function that does some simple inline parsing into LineBreak etc nodes (e.g. inlinetext("foo\\\nbar") -> [Text("foo"), LineBreak(), Text("bar")]).
CommonMark has implemented dedicated inlines for these characters. But do we actually need them here?
MarkdownAST.jl/src/markdown.jl
Lines 467 to 469 in 72c5f6c
LineBreak
(b45a1e5, 2f77d57)SoftBreak
Backslash
The text was updated successfully, but these errors were encountered: