diff options
author | Fabien LOISON <flo@flogisoft.com> | 2018-04-23 19:11:24 +0200 |
---|---|---|
committer | Fabien LOISON <flo@flogisoft.com> | 2018-04-23 19:11:24 +0200 |
commit | b2e7b8b6005b0f4493bfd69e6f0a981bd16f09d9 (patch) | |
tree | f094b81d6946cb9fcba84ab07c138ec10e017504 /app/Resources | |
parent | 11f15430ffc67e30f084cffc8e909ace87ce19e1 (diff) | |
download | wallabag-b2e7b8b6005b0f4493bfd69e6f0a981bd16f09d9.tar.gz wallabag-b2e7b8b6005b0f4493bfd69e6f0a981bd16f09d9.tar.zst wallabag-b2e7b8b6005b0f4493bfd69e6f0a981bd16f09d9.zip |
Highlight code in articles using highlight.js
Diffstat (limited to 'app/Resources')
-rw-r--r-- | app/Resources/static/themes/_global/index.js | 4 | ||||
-rw-r--r-- | app/Resources/static/themes/_global/js/highlight.js | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index fddb476d..7f7e87c0 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js | |||
@@ -13,8 +13,10 @@ import './global.scss'; | |||
13 | import './js/shortcuts/entry'; | 13 | import './js/shortcuts/entry'; |
14 | import './js/shortcuts/main'; | 14 | import './js/shortcuts/main'; |
15 | 15 | ||
16 | import { savePercent, retrievePercent } from './js/tools'; | 16 | /* Hightlight */ |
17 | import './js/highlight'; | ||
17 | 18 | ||
19 | import { savePercent, retrievePercent } from './js/tools'; | ||
18 | 20 | ||
19 | /* ========================================================================== | 21 | /* ========================================================================== |
20 | Annotations & Remember position | 22 | Annotations & Remember position |
diff --git a/app/Resources/static/themes/_global/js/highlight.js b/app/Resources/static/themes/_global/js/highlight.js new file mode 100644 index 00000000..4025fc14 --- /dev/null +++ b/app/Resources/static/themes/_global/js/highlight.js | |||
@@ -0,0 +1,8 @@ | |||
1 | import 'highlight.js/styles/atom-one-light.css'; | ||
2 | import * as hljs from 'highlight.js'; | ||
3 | |||
4 | window.addEventListener('load', () => { | ||
5 | document.querySelectorAll('pre').forEach((node) => { | ||
6 | hljs.highlightBlock(node); | ||
7 | }); | ||
8 | }); | ||