Created
December 30, 2017 00:20
-
-
Save derek-knox/23b42fd43c7f56f0a1686933ff26125c to your computer and use it in GitHub Desktop.
.md to .html highlight syntax for inline code vs code blocks using regex
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
var pattern = /<code>(markup|css|javascript) ?(.+)<\/code>/gm; | |
/* | |
The goal is to turn this markdown (highlight syntax inline vs code block): | |
...for HTML (`markup .html`)... | |
to this HTML: | |
...for HTML (<code class="language-markup">.html</code>`)... | |
My current problem is due to the latter part of my pattern: | |
(.+)<\/code> | |
How do I ensure the capture ends exactly at the "</code>" character sequence? | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment