highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.3k stars 3.52k forks source link

[Request] Documentation: How to use the Emitter API? #3974

Closed rauschma closed 5 months ago

rauschma commented 5 months ago

Is your request related to a specific problem you're having?\ I’m using Highlight.js to syntax-highlight code for LaTeX documents. I tried but failed to use the Emitter API.

The solution you'd prefer / feature you'd like to see added...\ I created a repository that would be enough documentation (if it worked...): [repository deleted]

Any alternative solutions you considered...\ My current workaround is to use package lowlight. But I don’t need the intermediate tree it creates; the Emitter API itself would be enough.

joshgoebel commented 5 months ago

Ignore my first response, you don't want to replace our parser - you want to replace the emitter itself.

The __emitter API (using our parser, but replacing our emitter) is a private (yet quite stable) API. As it's private [ie, unsupported] I can't offer real support, but if you want to learn about it I'd suggest:

rauschma commented 5 months ago

Thanks! (And thanks for Highlight.js in general – the library, its website and its complementary tools are a joy to use.)

rauschma commented 5 months ago

In case you are interested – this is how I use Highlight.js to produce PDFs with syntax-highlighted code: https://fosstodon.org/@rauschma/111800543890963559