Skip to content

Commit

Permalink
Chore: update highlightjs syntax (#1435)
Browse files Browse the repository at this point in the history
* Chore: update highlightjs syntax
See highlightjs/highlight.js#2277
Also updates vf-component-libary to 11ty 0.12.1
  • Loading branch information
khawkins98 authored Mar 22, 2021
1 parent 39063d6 commit 0925481
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
6 changes: 4 additions & 2 deletions tools/vf-component-library/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
### 1.2.0
### 1.1.0

* Adds the form options as their own set of components in the list.
* https://github.com/visual-framework/vf-core/pull/1390/files
* Updates to use 11ty 0.12.1
* https://github.com/visual-framework/vf-core/pull/1435

### 1.1.0
### 1.0.24

* changes the `vf-intro` so it's a white background, removes the padding.
* changes the links in `vf-intro` to be the 'correct' buttons.
Expand Down
2 changes: 1 addition & 1 deletion tools/vf-component-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"private": false,
"dependencies": {
"@11ty/eleventy": "0.11.1",
"@11ty/eleventy": "0.12.1",
"@visual-framework/vf-config": "^1.0.1-alpha.0",
"@visual-framework/vf-core": "^2.2.19",
"@visual-framework/vf-extensions": "^1.0.0-rc.0",
Expand Down
10 changes: 7 additions & 3 deletions tools/vf-extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Change Log
### 1.0.0-rc.1

## 1.0.0-rc.0
* Updates highlightjs syntax of render and codeblock tags
* https://github.com/visual-framework/vf-core/pull/1435
* https://github.com/highlightjs/highlight.js/issues/2277

### 1.0.0-rc.0

* Improve Eleventy-Fractal integration to avoid unnecessary Eleventy rebuilds on Sass and JS updates.
* https://github.com/visual-framework/vf-core/pull/1309

## 1.0.0-alpha.9
### 1.0.0-alpha.9

* Update documentation note on pointing to `gulp-build-search-index.js`
* Search indexer now removes html areas wrapped in `class="vf-search-client-side--no-index"`
6 changes: 1 addition & 5 deletions tools/vf-extensions/tags/codeblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ const hljs = require('highlight.js');

// Return a block of syntax as code with style formatting
// uses: https://highlightjs.org/

// Sample:
// {% codeblock 'html' -%}
// <link rel="stylesheet" href="https://dev.assets.emblstatic.net/vf/develop/css/styles.css">
// <script src="https://dev.assets.emblstatic.net/vf/develop/scripts/scripts.js"></script>
// {% endcodeblock %}

module.exports = function(nunjucksEngine,fractal){

function codeblockExtension() {

this.tags = ['codeblock'];
Expand All @@ -36,13 +34,11 @@ module.exports = function(nunjucksEngine,fractal){
// let format = format || 'html'; // if format is not set, use "html"
let txt = body();
if(typeof txt == "undefined") return;
txt = hljs.highlight(format, txt).value;
txt = hljs.highlight(txt, {language: format, ignoreIllegals: true }).value;

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Mar 23, 2021

The default for ignoreIllegals is false, so this is a change in behavior, just FYI. Now you are ignoring illegals where-as before you were not. Perhaps that was intentional. I dunno.

This comment has been minimized.

Copy link
@khawkins98

khawkins98 Mar 23, 2021

Author Contributor

Thanks for the heads up, I miss-inferred the default behaviour.


return new nunjucksEngine.runtime.SafeString(`<pre class="vf-code-example__pre"><code class="Code Code--lang-${format} vf-code-example">${txt}</code></pre>`);
};

};

return new codeblockExtension();

};
2 changes: 1 addition & 1 deletion tools/vf-extensions/tags/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = function (nunjucksEngine,fractal) {
}
if (highlight) {
const hljs = require('highlight.js');
html = hljs.highlight(codetype, html).value;
html = hljs.highlight(html, {language: codetype, ignoreIllegals: true }).value;

This comment has been minimized.

Copy link
@joshgoebel

joshgoebel Mar 23, 2021

Ditto on ignoreIllegals comment.

}
if (escape) {
// escaped by default, so just don't pass a safe string
Expand Down
6 changes: 6 additions & 0 deletions tools/vf-frctl-extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 1.0.1

* Updates highlightjs syntax of codeblock tag
* https://github.com/visual-framework/vf-core/pull/1435
* https://github.com/highlightjs/highlight.js/issues/2277

### 1.0.0

- Initial release to be used with vf-core 2.2.0
2 changes: 1 addition & 1 deletion tools/vf-frctl-extensions/codeblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function(fractal){
// let format = format || 'html'; // if format is not set, use "html"
let txt = body();
if(typeof txt == "undefined") return;
txt = hljs.highlight(format, txt).value;
txt = hljs.highlight(txt, {language: format, ignoreIllegals: true }).value;

return `<pre class="vf-code-example__pre"><code class="Code Code--lang-${format} vf-code-example">${txt}</code></pre>`;
};
Expand Down

0 comments on commit 0925481

Please sign in to comment.