update markdown rendering approach #1133
Merged
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.
What this PR does:
marked
andhighlight.js
to the latest versionsPreviously we were parsing the markdown with the vanilla tokenizer from marked. This meant that we had to make some massaging of the tokens to successfully remove extra paragraphs when inside a curly or angle bracket syntax (see
compactParagraphs
function).This new proposal makes use of marked's extensions, trying to accomplish a similar same thing.
One advantage is that the content inside an html or hbs block now is preserved, including whitespace.
As an example, previously compiling this markdown:
{{#foo-bar}} hello {{/foo-bar}}
resulted in the following hbs:
But now it results in the the following:
Notice how everything inside
{{#foo-bar}}
and{{/foo-bar}}
is preserved. Same thing happens for html/angle bracket components.This explains why I had to change tests.
Test coverage was good, but I went manually to every single page in the docs app and everything looks good.
Since @dfreeman seems to have worked on this code in the past, I'm going to mention him. Would be great to get another pair of eyes, at least in the test changes. :)