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

Enable Callouts in AsciiDoc Extension for Highlight #36

Open
tajmone opened this issue Oct 31, 2018 · 5 comments
Open

Enable Callouts in AsciiDoc Extension for Highlight #36

tajmone opened this issue Oct 31, 2018 · 5 comments
Assignees
Labels
🕑 pending implementation Approved changes waiting to be implemented 👑 HTML Format Issues with conversion to HTML format 🔨 Highlight Tool: Highlight (syntax highlighter) ♻️ help wanted Collaborative help is needed ⭐ syntax highlighting Topic: Syntax Highlighting 👅 Ruby Lang: Ruby ⚠️ useful Priority: Low

Comments

@tajmone
Copy link
Collaborator

tajmone commented Oct 31, 2018

Update the highlight-treeprocessor.rb extension to add support for callouts in Highlight extension, so that Highlight can be used instead of Highlight.js for syntax highlighting HTML-based backends.

This is prefarable to using Hihglight.js for it allows static syntax highlighting, easier usage of custom syntaxes, and because Highlight offers more options to customize results.

For more info, see #99:

@tajmone tajmone added 👑 HTML Format Issues with conversion to HTML format 🕑 pending implementation Approved changes waiting to be implemented ⭐ syntax highlighting Topic: Syntax Highlighting labels Oct 31, 2018
@tajmone tajmone self-assigned this Oct 31, 2018
@tajmone tajmone added this to the Highlight Integration milestone Oct 31, 2018
@tajmone tajmone added 🔨 Highlight Tool: Highlight (syntax highlighter) ⚠️ important Priority: High labels Aug 13, 2019
@tajmone
Copy link
Collaborator Author

tajmone commented Aug 13, 2019

Still Struggling...

Since the creation of this issue, I've updated various times my custom version of highlight-treeprocessor_mod.rb — now it fully supports substitutions, correctly allows using line-numbering, and even allows enforcing custom syntax definitions over built-in syntaxes via env vars.

Basically, it's now possible to use Highlight for the HTML backend of every document that doesn't use call-outs.

To Switch, or Not to Swtich? That Is The Dilemma

On the one hand, I'm tempted to switch to Highlight all those docs that don't use call-outs, but on the other hand I think that call-outs are such a cool feature that it might be best to wait that Highlight supports them. The problem here is that, in the meantime, Asciidoctor switched to a new syntax highlighter interface, so my extension is already obsolete (although it works).

Help! Any Rubyists Listening?

I wish I knew Ruby better, for I looked into the new Asciidoctor API for highlighters, but I just can't hack my way through it (I've lost count of the hours spent in attempting to solve this).

Unfortunately, it seems that Highlight integration has a very low priority in the Asciidoctor agenda (even though Highlight is one of the oldest highlighters on the scene, and the one offering more built-in syntaxes than any other, more energy has been invested in other highlighters).

I could really do with some help from someone fluent in Ruby!!! Together we could quickly create an extension using the new Asciidoctor API 2.0 and settle the matter of Highlight integration once and for all.

@tajmone tajmone added ♻️ help wanted Collaborative help is needed 👅 Ruby Lang: Ruby labels Aug 13, 2019
tajmone added a commit that referenced this issue Aug 30, 2019
First Glossary draft with an initial entry (*stropping*) and some
commented-out pending entries TBD later on (Closes #54).

Update contents of "§4.2. Words, Identifiers and Names":

 * Add "Stropping" sub-section.
 * Add `stropping` anchor.
 * Add `stropping` Index entry.
 * Revise and improve contents of this section:
    * More examples.
    * Extra admonitions.
    * Polish text.

Clean-up, polish and update README files in Alan Manual directory.

Referenced Issues: #36, #50, #54, asciidoctor/asciidoctor#3248.
tajmone added a commit that referenced this issue Sep 1, 2019
First Glossary draft with an initial entry (*stropping*) and some
commented-out pending entries TBD later on (Closes #54).

Update contents of "§4.2. Words, Identifiers and Names":

 * Add "Stropping" sub-section.
 * Add `stropping` anchor.
 * Add `stropping` Index entry.
 * Revise and improve contents of this section:
    * More examples.
    * Extra admonitions.
    * Polish text.

Clean-up, polish and update README files in Alan Manual directory.

Referenced Issues: #36, #50, #54, asciidoctor/asciidoctor#3248.
tajmone added a commit that referenced this issue Sep 1, 2019
First Glossary draft with an initial entry (*stropping*) and some
commented-out pending entries TBD later on (Closes #54).

Update contents of "§4.2. Words, Identifiers and Names":

 * Add "Stropping" sub-section.
 * Add `stropping` anchor.
 * Add `stropping` Index entry.
 * Revise and improve contents of this section:
    * More examples.
    * Extra admonitions.
    * Polish text.

Clean-up, polish and update README files in Alan Manual directory.

Referenced Issues: #36, #50, #54, asciidoctor/asciidoctor#3248.
tajmone added a commit that referenced this issue Sep 18, 2020
First Glossary draft with an initial entry (*stropping*) and some
commented-out pending entries TBD later on (Closes #54).

Update contents of "§4.2. Words, Identifiers and Names":

 * Add "Stropping" sub-section.
 * Add `stropping` anchor.
 * Add `stropping` Index entry.
 * Revise and improve contents of this section:
    * More examples.
    * Extra admonitions.
    * Polish text.

Clean-up, polish and update README files in Alan Manual directory.

Referenced Issues: #36, #50, #54, asciidoctor/asciidoctor#3248.
@tajmone
Copy link
Collaborator Author

tajmone commented Sep 18, 2020

Switching to Rouge?

EDIT — moved to #107!

This problem of adding callouts support to Highlight has been pending a solution for so many years that I think it might be worth considering switching to Rouge instead, and create an ALAN definition for it.

Rouge has the following pros and cons over Highlight:

  • PROS:
    • It's natively supported by Asciidoctor Ruby, for both the HTML and Asciidoctor PDF backends; see: §46.2. Available Source Highlighters.
      • When the Asciidoctor v2.0.0 update will be released, syntax highlight via Rouge won't break (whereas our Highlight extension will probably stop working).
    • It's written in Ruby, so it integrates well with Asciidoctor Ruby.
    • Its Lexer is state-driven, so it can handle powerful syntax constructs (e.g. nested states), pretty much like Pygments.
    • Doesn't require end users to install another language dependency (like Python for Pygments), since Asciidoctor users will have installed Ruby already.
    • Its themes are 100% compatible with Pygments stylesheets.
  • CONS:
    • Only supports UTF-8! so we might have problems with ISO-8859-1 ALAN sources (but this is already a problem with Asciidoctor anyhow).
    • The documentation on how to write a Lexer was lacking (or poor) in the past; but now it seems it's been documented, and that some tutorials are available.
    • Using a custom syntax for the repository might be a bit trickier, compared to Highlight.

tajmone added a commit that referenced this issue Sep 20, 2020
First Glossary draft with an initial entry (*stropping*) and some
commented-out pending entries TBD later on (Closes #54).

Update contents of "§4.2. Words, Identifiers and Names":

 * Add "Stropping" sub-section.
 * Add `stropping` anchor.
 * Add `stropping` Index entry.
 * Revise and improve contents of this section:
    * More examples.
    * Extra admonitions.
    * Polish text.

Clean-up, polish and update README files in Alan Manual directory.

Referenced Issues: #36, #50, #54, asciidoctor/asciidoctor#3248.
@tajmone
Copy link
Collaborator Author

tajmone commented May 24, 2021

@tajmone
Copy link
Collaborator Author

tajmone commented May 24, 2021

New Highlight 4 Feature Request at Asciidoctor

Follow also this new Issue I've opened:

asciidoctor/asciidoctor#4069

tajmone added a commit to alan-if/Alan-Testbed that referenced this issue Jun 12, 2021
Thanks to @mojavelinux (asciidoctor/asciidoctor#4080) we now have our
first working test on how to use Asciidoctor with custom lexers for ALAN
that are not part of the Rouge gem.

This milestone confirms that we'll be able to address and fix the Issues
discussed at alan-if/alan-docs#107 and alan-if/alan-docs#36.
@tajmone tajmone added ⚠️ useful Priority: Low and removed ⚠️ important Priority: High labels Jul 30, 2021
@tajmone
Copy link
Collaborator Author

tajmone commented Jul 30, 2021

Downgraded From "Important" to "Useful"

Now that we can also use Rouge for highlighting, Highlight is only used for those documents which need to add spans or highlight/marked to code blocks (which is currently unsupported in Rouge), so fixing the HL ADoc Extensions is no longer a high priority (still, it would be nice to see it done).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕑 pending implementation Approved changes waiting to be implemented 👑 HTML Format Issues with conversion to HTML format 🔨 Highlight Tool: Highlight (syntax highlighter) ♻️ help wanted Collaborative help is needed ⭐ syntax highlighting Topic: Syntax Highlighting 👅 Ruby Lang: Ruby ⚠️ useful Priority: Low
Projects
None yet
Development

No branches or pull requests

1 participant