atom-language-asciidoc icon indicating copy to clipboard operation
atom-language-asciidoc copied to clipboard

Publish package to npm

Open mojavelinux opened this issue 8 years ago • 5 comments

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);

mojavelinux avatar Apr 02 '17 03:04 mojavelinux

Have you a real use case ?

ldez avatar Apr 02 '17 10:04 ldez

Yes. I plan to integrate highlights as the convert-time syntax highlighter in Asciidoctor.js.

mojavelinux avatar Apr 02 '17 21:04 mojavelinux

Can you create an Org on NPM for Asciidoctor ? Create org

ldez avatar Apr 02 '17 22:04 ldez

We already have one. I'll add you.

mojavelinux avatar Apr 03 '17 00:04 mojavelinux

Done.

mojavelinux avatar Apr 03 '17 00:04 mojavelinux