@mapbox/rehype-prism
Advanced tools
Comparing version 0.7.0 to 0.8.0
# Changelog | ||
## 0.8.0 | ||
- Add `alias` option to support aliases in refractor. | ||
## 0.7.0 | ||
@@ -4,0 +8,0 @@ |
@@ -10,2 +10,6 @@ 'use strict'; | ||
if (options.alias) { | ||
refractor.alias(options.alias); | ||
} | ||
return (tree) => { | ||
@@ -12,0 +16,0 @@ visit(tree, 'element', visitor); |
{ | ||
"name": "@mapbox/rehype-prism", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "rehype plugin to highlight code blocks in HTML with Prism", | ||
@@ -11,3 +11,4 @@ "main": "index.js", | ||
"pretest": "npm run lint", | ||
"test": "jest" | ||
"test": "jest", | ||
"prepare": "husky install" | ||
}, | ||
@@ -33,2 +34,3 @@ "repository": { | ||
"hast-util-to-string": "^1.0.4", | ||
"mrm": "^3.0.9", | ||
"refractor": "^3.4.0", | ||
@@ -40,8 +42,8 @@ "unist-util-visit": "^2.0.3" | ||
"dedent": "^0.7.0", | ||
"eslint": "^7.29.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"husky": "^4.3.8", | ||
"jest": "^27.0.6", | ||
"lint-staged": "^10.5.4", | ||
"prettier": "^2.3.2", | ||
"husky": "^7.0.2", | ||
"jest": "^27.2.1", | ||
"lint-staged": "^11.1.2", | ||
"prettier": "^2.4.1", | ||
"rehype": "^11.0.0" | ||
@@ -53,9 +55,8 @@ }, | ||
"prettier --write" | ||
], | ||
"*.js": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"jest": { | ||
@@ -62,0 +63,0 @@ "coverageReporters": [ |
@@ -41,2 +41,9 @@ # @mapbox/rehype-prism | ||
#### options.alias | ||
Type: `Record<string, string | string[]>`. | ||
Default: `undefined`. | ||
Provide [aliases] to refractor to register as alternative names for a language. | ||
## Usage | ||
@@ -108,1 +115,3 @@ | ||
[language supported by refractor]: https://github.com/wooorm/refractor#syntaxes | ||
[aliases]: https://github.com/wooorm/refractor#refractoraliasname-alias |
14
test.js
@@ -64,1 +64,15 @@ 'use strict'; | ||
}); | ||
test('with options.alias it can highlight language aliases', () => { | ||
const html = dedent` | ||
<pre> | ||
<code class="language-vue"> | ||
<script setup> | ||
const id = 7 | ||
</script> | ||
</code> | ||
</pre> | ||
`; | ||
const result = processHtml(html, { alias: { markup: ['vue', 'html'] } }); | ||
expect(result).toMatchSnapshot(); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13357
10
112
116
4
+ Addedmrm@^3.0.9
+ Added@sindresorhus/is@0.14.0(transitive)
+ Added@szmarczak/http-timer@1.1.2(transitive)
+ Addedansi-align@2.0.03.0.1(transitive)
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-regex@2.1.13.0.14.1.15.0.1(transitive)
+ Addedansi-styles@2.2.13.2.14.3.0(transitive)
+ Addedbabel-code-frame@6.26.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedboxen@1.3.04.2.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuiltins@1.0.3(transitive)
+ Addedcacheable-request@6.1.0(transitive)
+ Addedcamelcase@4.1.05.3.1(transitive)
+ Addedcapture-stack-trace@1.0.2(transitive)
+ Addedchalk@1.1.32.4.23.0.04.1.2(transitive)
+ Addedchardet@0.7.0(transitive)
+ Addedci-info@1.6.02.0.0(transitive)
+ Addedcli-boxes@1.0.02.2.1(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-width@3.0.0(transitive)
+ Addedcliui@5.0.0(transitive)
+ Addedclone-response@1.0.3(transitive)
+ Addedcolor-convert@1.9.32.0.1(transitive)
+ Addedcolor-name@1.1.31.1.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcomment-json@2.4.2(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconfigstore@3.1.55.0.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcreate-error-class@3.0.2(transitive)
+ Addedcross-spawn@5.1.0(transitive)
+ Addedcrypto-random-string@1.0.02.0.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddefer-to-connect@1.1.3(transitive)
+ Addeddetect-indent@6.1.0(transitive)
+ Addeddot-prop@4.2.15.3.0(transitive)
+ Addeddotenv@5.0.1(transitive)
+ Addedduplexer3@0.1.5(transitive)
+ Addededitorconfig@0.15.3(transitive)
+ Addedemoji-regex@7.0.38.0.0(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedescape-goat@2.1.1(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedexeca@0.7.0(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextend-shallow@2.0.1(transitive)
+ Addedexternal-editor@3.1.0(transitive)
+ Addedfigures@3.2.0(transitive)
+ Addedfind-up@3.0.04.1.0(transitive)
+ Addedfs-exists-sync@0.1.0(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedget-stream@3.0.04.1.05.2.0(transitive)
+ Addedgit-config-path@1.0.1(transitive)
+ Addedgit-username@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglobal-dirs@0.1.12.1.0(transitive)
+ Addedgot@6.7.19.6.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@3.0.04.0.0(transitive)
+ Addedhas-own-prop@2.0.0(transitive)
+ Addedhas-yarn@2.1.0(transitive)
+ Addedhomedir-polyfill@1.0.3(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedimport-lazy@2.1.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedini@1.3.71.3.8(transitive)
+ Addedinquirer@7.3.3(transitive)
+ Addedis-ci@1.2.12.0.0(transitive)
+ Addedis-directory@0.3.1(transitive)
+ Addedis-extendable@0.1.1(transitive)
+ Addedis-fullwidth-code-point@2.0.03.0.0(transitive)
+ Addedis-installed-globally@0.1.00.3.2(transitive)
+ Addedis-npm@1.0.04.0.0(transitive)
+ Addedis-obj@1.0.12.0.0(transitive)
+ Addedis-path-inside@1.0.13.0.3(transitive)
+ Addedis-redirect@1.0.0(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedis-yarn-global@0.3.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-tokens@3.0.2(transitive)
+ Addedjson-buffer@3.0.0(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addedkeyv@3.1.0(transitive)
+ Addedkleur@3.0.3(transitive)
+ Addedlatest-version@3.1.05.1.0(transitive)
+ Addedlibnpx@10.2.4(transitive)
+ Addedlistify@1.0.3(transitive)
+ Addedlocate-path@3.0.05.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlongest@2.0.1(transitive)
+ Addedlowercase-keys@1.0.12.0.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmake-dir@1.3.03.1.0(transitive)
+ Addedmiddleearth-names@1.1.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmrm@3.0.10(transitive)
+ Addedmrm-core@6.1.7(transitive)
+ Addedmute-stream@0.0.8(transitive)
+ Addednormalize-url@4.5.1(transitive)
+ Addednpm-package-arg@6.1.1(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedp-cancelable@1.1.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.04.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpackage-json@4.0.16.5.0(transitive)
+ Addedparse-git-config@1.1.1(transitive)
+ Addedparse-github-url@1.0.3(transitive)
+ Addedparse-passwd@1.0.0(transitive)
+ Addedpath-exists@3.0.04.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-is-inside@1.0.2(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpify@3.0.0(transitive)
+ Addedprepend-http@1.0.42.0.0(transitive)
+ Addedprop-ini@0.0.2(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedpupa@2.1.1(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedreadme-badger@0.3.0(transitive)
+ Addedregistry-auth-token@3.4.04.2.2(transitive)
+ Addedregistry-url@3.1.05.1.0(transitive)
+ Addedremote-origin-url@1.0.0(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedresponselike@1.0.2(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedrun-async@2.4.1(transitive)
+ Addedrxjs@6.6.7(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsemver@5.7.26.3.1(transitive)
+ Addedsemver-diff@2.1.03.1.1(transitive)
+ Addedsemver-utils@1.1.4(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsigmund@1.0.1(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsmpltmpl@1.0.2(transitive)
+ Addedsplit-lines@2.1.0(transitive)
+ Addedstring-width@2.1.13.1.04.2.3(transitive)
+ Addedstrip-ansi@3.0.14.0.05.2.06.0.1(transitive)
+ Addedstrip-bom@4.0.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedsupports-color@2.0.05.5.07.2.0(transitive)
+ Addedterm-size@1.2.02.2.1(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtimed-out@4.0.1(transitive)
+ Addedtmp@0.0.33(transitive)
+ Addedto-readable-stream@1.0.0(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedtype-fest@0.21.30.8.1(transitive)
+ Addedtypedarray-to-buffer@3.1.5(transitive)
+ Addedunique-random@1.0.0(transitive)
+ Addedunique-random-array@1.0.0(transitive)
+ Addedunique-string@1.0.02.0.0(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addedunzip-response@2.0.1(transitive)
+ Addedupdate-notifier@2.5.04.1.3(transitive)
+ Addedurl-parse-lax@1.0.03.0.0(transitive)
+ Addeduser-home@2.0.0(transitive)
+ Addeduser-meta@1.0.0(transitive)
+ Addedvalidate-npm-package-name@3.0.0(transitive)
+ Addedwebpack-merge@4.2.2(transitive)
+ Addedwhich@1.3.12.0.2(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwidest-line@2.0.13.1.0(transitive)
+ Addedwrap-ansi@5.1.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite-file-atomic@2.4.33.0.3(transitive)
+ Addedxdg-basedir@3.0.04.0.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyaml@2.6.1(transitive)
+ Addedyargs@14.2.3(transitive)
+ Addedyargs-parser@15.0.3(transitive)