Skip to content

Commit

Permalink
Merge 6647cc2 into 09857c4
Browse files Browse the repository at this point in the history
  • Loading branch information
adamszalapski authored Dec 10, 2018
2 parents 09857c4 + 6647cc2 commit 2ffa931
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@ class BoltCodeSnippetClass extends withPreact() {
syntax: props.string,
};

highlightHTML(code, lang) {
const escapedLangs = ['scss'];

code = escapedLangs.includes(lang)
? code
.replace(/&/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
: code;
const highlightedHTML = Prism.highlight(code, Prism.languages[lang]);
replaceEntities(string) {
return string
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>');
}

return highlightedHTML;
highlightHTML(code, lang) {
return Prism.highlight(this.replaceEntities(code), Prism.languages[lang]);
}

constructor(self) {
Expand Down

0 comments on commit 2ffa931

Please sign in to comment.