Login  Register

Re: Interpret links (or other AsciiDoc syntax) only in specific lines of a [source] block

Posted by mojavelinux on Feb 18, 2021; 9:47pm
URL: https://discuss.asciidoctor.org/Interpret-links-or-other-AsciiDoc-syntax-only-in-specific-lines-of-a-source-block-tp8499p8520.html

On Thu, Feb 18, 2021 at 11:50 AM Oblomov [via Asciidoctor :: Discussion] <[hidden email]> wrote:
OK, there is ONE annoying thing about this strategy, that I've seen so far: even if the only thing I want to do is override one particular aspect, I basically have to copy over the entire highlight method.

Yes, that is a limitation.
 
Let's say that I only want to support rouge: `highlight` does a lot of autoguessing and formatter tuning, and then closes by calling the formatter on the lexer on the source. It would be nice if there a hook right before that line, so that a plugin or extension could do fine-tuning to the lexer and/or formatter without having to copy the entire logic of the function 8-/

It's better to think of it in a functional way. The logic to prepare the lexer and formatter should be moved to a dedicate function so it can be replaced or intercepted. I don't think that's something that the adapter interface should enforce, but it can be something that the individual adapters do. If you'd like to propose a code change, I'll definitely consider it.

Best Regards,

-Dan
 
--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux