Skip to content

Commit

Permalink
docs(11ty): improve HTML syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoodd committed Mar 3, 2022
1 parent 0f1e3a6 commit 85dbd86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion a11y.css.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ const parseSassComment = comment => {
const content = fm(comment)
let processedContent = new showdown.Converter().makeHtml(content.body)


const htmlRegex = /((?<=<code class="html language-html">)(.[\s\S]+?)(?=<\/code>))/gm
let htmlContent = processedContent.match(htmlRegex)
let processedHTML = prism.highlight(String(htmlContent), prism.languages.html, 'html')
htmlContent = String(htmlContent).replace(/(&lt;)+/g, '<')
htmlContent = htmlContent.replace(/(&gt;)+/g, '>')
let processedHTML = prism.highlight(htmlContent, prism.languages.html, 'html')
const cssRegex = /((?<=<code class="css language-css">)(.[\s\S]+?)(?=<\/code>))/gm
let cssContent = processedContent.match(cssRegex)
let processedCSS = prism.highlight(String(cssContent), prism.languages.css, 'css')
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ h2[id]::before {
background: #f3f0e0;
bottom: 0;
content: "";
left: -3rem;
left: -2rem;
position: absolute;
top: 0;
z-index: -2;
Expand Down

0 comments on commit 85dbd86

Please sign in to comment.