asciidoctor / atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
https://atom.io/packages/language-asciidoc
MIT License
42 stars 20 forks source link

Publish package to npm #181

Open mojavelinux opened 7 years ago

mojavelinux commented 7 years ago

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);
ldez commented 7 years ago

Have you a real use case ?

mojavelinux commented 7 years ago

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

ldez commented 7 years ago

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

mojavelinux commented 7 years ago

We already have one. I'll add you.

mojavelinux commented 7 years ago

Done.