This does a few things to improve compatibility with remark/rehype:
Start inserting line breaks at the end of heading tags. Looks like the original implementation simply forgot to include the \n at the end. Then there are some test changes to respond to this.
Allow width on td tags. This is specified in the tables.md fixture, but was being sanitized in the output.
Manually insert rel="noopener noreferrer" into tables.md fixture and output. Marked parses this entire thing with a token.type of html, and so the overridden link function in our renderer does not get invoked here. Rather than try to fix this programmatically, I thought it would be easier to just fix the test.
People probably shouldn't be inserting giant raw anchor tags into their markdown, so I suspect this won't impact people. Additionally, not having this attribute is a slight security concern, so people should be doing it anyway.
Add some basic tests covering anchor tags.
A special hack to change how lists live inside summary tags. There's a more detailed comment in mod.ts and you can see the fixture result changes to not have the extra line (in addition to removing whitespace at the start). Again, this is necessary due to https://github.com/rehypejs/rehype-raw converting raw html into an AST. Perhaps this warrants some extra tests around summary tags?
This does a few things to improve compatibility with remark/rehype:
heading
tags. Looks like the original implementation simply forgot to include the\n
at the end. Then there are some test changes to respond to this.width
ontd
tags. This is specified in thetables.md
fixture, but was being sanitized in the output.Manually insert
rel="noopener noreferrer"
intotables.md
fixture and output.Marked
parses this entire thing with atoken.type
ofhtml
, and so the overriddenlink
function in our renderer does not get invoked here. Rather than try to fix this programmatically, I thought it would be easier to just fix the test.The reason why this is necessary is because https://github.com/rehypejs/rehype-raw will convert the raw html into an AST. And then later on https://github.com/rehypejs/rehype-external-links will deal with the external links.
People probably shouldn't be inserting giant raw anchor tags into their markdown, so I suspect this won't impact people. Additionally, not having this attribute is a slight security concern, so people should be doing it anyway.
anchor
tags.mod.ts
and you can see the fixture result changes to not have the extra line (in addition to removing whitespace at the start). Again, this is necessary due to https://github.com/rehypejs/rehype-raw converting raw html into an AST. Perhaps this warrants some extra tests aroundsummary
tags?