Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activating Reveal.js Extensions only for Reveal.js backend #489

Open
rahmanusta opened this issue Dec 26, 2022 · 1 comment
Open

Activating Reveal.js Extensions only for Reveal.js backend #489

rahmanusta opened this issue Dec 26, 2022 · 1 comment
Labels
🎤 discussion Items that needs to be discussed with the broader Asciidoctor community 🙋 need info

Comments

@rahmanusta
Copy link
Contributor

Hello,

In AsciidocFX, I use AsciidoctorJ to construct a certain number of Asciidoctor instances and load all required libraries all at once. I recently discovered that the highlight js numbering extension registers itself even though that the backend is HTML5. I assumed the asciidoctor-* libraries were isolated from each other if they targeted a specific backend. I think the library should not interfere with the other backends. May it be possible to activate Reveal's highlight.js extension only if the backend is reveal.js ?

class HighlightJsAdapter < Asciidoctor::SyntaxHighlighter::Base

@ggrossetie
Copy link
Member

Hey!

It might be possible to conditionally call SyntaxHighlighter.register instead of using:

register_for 'highlightjs', 'highlight.js'

However, I'm not really sure how/when we should call it since the SyntaxHighlighter registry is a singleton so I don't think you can have more than one instance.

We could potentially use the backend argument in the constructor to delegate or not to the built-in Highlight.js syntax highlighter when the backend is html5 or revealjs:

https://github.com/asciidoctor/asciidoctor/blob/40bc23cbc105d87ce25892d4c1866fad7f9ba01a/lib/asciidoctor/syntax_highlighter.rb#L19

In other words, the highlight.js adapter (from this converter) will still override the built-in highlight.js syntax highlighter in the registry but use the built-in when the backend is not revealjs. What do you think?

@ggrossetie ggrossetie added 🙋 need info 🎤 discussion Items that needs to be discussed with the broader Asciidoctor community labels May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎤 discussion Items that needs to be discussed with the broader Asciidoctor community 🙋 need info
Projects
None yet
Development

No branches or pull requests

2 participants