Open markstamer opened 3 months ago
I think this might affect all Markdown libraries, because it's seeing them as HTML. For example, if I paste that same thing into iA Writer on my Mac (my Markdown editor), it does exactly the same thing.
Outch, so writing an article about Swift generics using the markdown content approach of Ignite could be a bit of a problem.
I don't have iA Writer to see it for myself but in VSCode previews it works. Maybe there is a misunderstanding in that I meant the code is either inline code or in a code block. Being able to display HTML code in a code block should be working in every Markdown library?
I've also had some issues with Swift code, specially a for loop with x..<y
. I've been digging a bit and it seems that even tho the that code is inside a <pre>
tag, that doesn't stop browsers from trying to parse html tags inside it. I've found that changing https://github.com/twostraws/Ignite/blob/02c14aefbd93b8cb31c27515c8104336c80d9d36/Sources/Ignite/Rendering/Markdown/MarkdownToHTML.swift#L126 to escape the string from codeBlock.code
solves the problems.
It's interesting that there are no more reports of this issue so maybe my conclusions are wrong.
I stumbled across an issue where a code snippet in a markdown file, such as,
func store(in set: inout Set<AnyCancellable>) { }
is rendered asfunc store(in set: inout Set) { }
. The generic type is simple removed from the Set. Unfortunately I could find the issue in the Ignite framework or if this is an issue with swift-markdown.