Hi everyone,
I am trying to lint text in asciidoctor documents. Being able to access the tokens generated by the parser would help me a great deal with it. From there it would possible to skip code blocks or to be sure to run the linter on text nodes only. If someone could point me the way to do it in Ruby, maybe I can figure out a way to to it with asciidoctorjs (I'm working in node). Thanks in advance! PS: marked gives access to its parser, which is pretty awesome! |
Administrator
|
Asciidoctor does not provide low-level access to tokens. But there are various ways to interact with the AST that it does produce to accomplish your goal. The main entry point is the document and from there the list of blocks. See: That's a deep as it goes at the moment since the inline parsing is handled in a streaming fashion. That's why we have issue https://github.com/asciidoctor/asciidoctor/issues/61. In order to do all this in Asciidoctor.js, I recommend writing it in Ruby and compiling it to JavaScript using Opal. It's possible to access the AST from JavaScript, but the API is somewhat awkward. Still, it's workable once you get used to it. I recommend studying the chrome extension {1} and docgist {2} to see Asciidoctor.js in action. -Dan On Tue, Feb 23, 2016 at 8:26 AM, geowarin [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi everyone, Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Administrator
|
In reply to this post by geowarin
You might also want to study the JavaScript parts of AsciidocFX. -Dan On Tue, Feb 23, 2016 at 6:59 PM, Dan Allen <[hidden email]> wrote:
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |