Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
asciidoctor-prism-extension
Advanced tools
Highlight Asciidoc code listings with Prism.js, server side, with no front-end dependencies.
Highlight Asciidoc code listings with Prism.js, server side, with no front-end dependencies.
This module is intended to be used with Asciidoctor.js, and Node.js (v10+). It adds a new syntax highlighter, to be used when converting Asciidoc to HTML5 documents. The syntax highlighting happens during the document conversion.
$ npm install @asciidoctor/core asciidoctor-prism-extension
const asciidoctor = require('@asciidoctor/core')();
const prismExtension = require('asciidoctor-prism-extension');
asciidoctor.SyntaxHighlighter.register('prism', prismExtension);
This extension relies on Asciidoc attributes to affect the theme and the highlighted syntaxes.
= Document
:source-highlighter: prism
:prism-languages: bash,docker,jsx
...
Attribute | Default | Possible values |
---|---|---|
prism-theme | prism.css | Any filename in this list. |
prism-languages | asciidoc,bash,json,markdown,typescript,yaml | Any supported language. |
Theme can be disabled with the negated attribute (!
character):
= Document
:source-highlighter: prism
:prism-theme!:
:prism-languages: bash,docker,jsx
...
Then you convert as usual:
asciidoctor.convertFile('document.adoc', {
to_file: 'document.html',
backend: 'html5'
});
Note: attributes can be specified at this stage too. Have a look at Asciidoctor.js API to learn more about it.
Author your documents as you would regularly do. The second argument of a code listing hints the language to the syntax highlighter.
In the following example, yaml
is going to be used to colour the output:
[source,yaml]
.example.yml
----
language: node_js
node_js: node
script: npm test
----
Prism is a highly configurable syntax highlighter.
MIT.
FAQs
Highlight Asciidoc code listings with Prism.js, server side, with no front-end dependencies.
The npm package asciidoctor-prism-extension receives a total of 198 weekly downloads. As such, asciidoctor-prism-extension popularity was classified as not popular.
We found that asciidoctor-prism-extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.