Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
asciidoctor-extension-interactive-runner
Advanced tools
Readme
Transform static Asciidoc code listings into interactive playgrounds in web browsers. Turn them in microservices too!
Target the code listings with the %interactive
option and you're almost done!
At the moment, the extension is only compatible with JavaScript source code, handled with the runkit runner.
npm install asciidoctor.js asciidoctor-extension-interactive-runner
Add the %interactive
option to a source element, combined with the javascript
language syntax.
[source%interactive,javascript]
----
const {camelCase} = require('lodash');
console.log(camelCase('get content')); // <1>
----
<1> Now you can see the output of this line in the browser.
The extra option %endpoint
transforms the interactive code in an ephemeral web service.
[source%interactive%endpoint,javascript]
----
const micro = require('micro');
const {random} = require('pokemon');
const server = micro((req, res) => random());
server.listen(4000);
----
Limitation: you have to name the variable server
or to make it as the module.exports
for this feature to work.
You can specify a Node version with the runner-node
Asciidoc attribute.
Without specifying it, it is assumed it is the Node version converting the Asciidoc document.
:runner-node: v16
[source%interactive,javascript]
----
console.log(process.version);
----
const asciidoctor = require('@asciidoctor/core')();
const runnerExtension = require('asciidoctor-extension-interactive-runner');
runnerExtension.register(asciidoctor.Extensions);
asciidoctor.convertFile('path/to/content.adoc', {
to_file: 'path/to/content.html',
backend: 'html5',
})
FAQs
Turn static Asciidoc code listings into interactive playgrounds in web browsers.
The npm package asciidoctor-extension-interactive-runner receives a total of 93 weekly downloads. As such, asciidoctor-extension-interactive-runner popularity was classified as not popular.
We found that asciidoctor-extension-interactive-runner 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.