atom-language-asciidoc
atom-language-asciidoc copied to clipboard
Publish package to npm
Description
Publish the package to npm so that it can be used with the highlights syntax highlighter in headless / library mode.
This seems to be a simple matter of running npm publish during a release. However, we may want to consider some excludes (using an .npmignore file). We should also qualify the package name as atom-language-asciidoc since we're publishing outside of the Atom ecosystem. (Another option for the name is highlights-language-asciidoc since technically it is not coupled to Atom).
For an example of another language, see https://www.npmjs.com/package/atom-language-nginx. I can't find a project that contains a script that shows how they are publishing to npm and apm under different package names.
Code example
If this package were published to npm, you could install packages using:
npm install highlights
npm install atom-language-asciidoc # or highlights-language-asciidoc
Then use it as follows:
Highlights = require('highlights');
highlighter = new Highlights();
highlighter.requireGrammarsSync({
modulePath: require.resolve('language-asciidoc/package.json')
});
html = highlighter.highlightSync({
fileContents: '= Document Title\nAuthor Name\n\ncontent',
scopeName: 'source.asciidoc'
});
console.log(html);
Have you a real use case ?
Yes. I plan to integrate highlights as the convert-time syntax highlighter in Asciidoctor.js.
Can you create an Org on NPM for Asciidoctor ? Create org
We already have one. I'll add you.
Done.