-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix: Ignore words in info string after syntax (fixes #166) This was working correctly in v1 but stopped working when v2 switched to the new processor API. The generated filename was `0.js more words are ignored`. The test case for this was insufficiently strict: it asserted that the code block was extracted, which was sufficient with hard-coded extensions in v1, but it didn't assert the generated name was `0.js` now that we're taking the extension from the info string. Per CommonMark 0.29 [1]: > The line with the opening code fence may optionally contain some text > following the code fence; this is trimmed of leading and trailing > whitespace and called the info string. I've strengthened the tests for generated filename extensions and added a new test to ensure that leading whitespace is trimmed correctly. [1]: https://spec.commonmark.org/0.29/#info-string * Use replace instead of trimStart for Node.js 8.x * Ignore trailing whitespace in info strings Markdown info strings permit trimming both leading and trailing whitespace, so this shouldn't cause issues. `.trim()` is much nicer than a regex `.replace()`.
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters