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

Line number treeprocessor #85

Closed
wants to merge 2 commits into from

Conversation

danyill
Copy link
Contributor

@danyill danyill commented Apr 1, 2018

I wanted to provide an example of how to extract line number information using role (the "easy" way) and also how to undertake a more semantically correct way of extracting the file and line number and adding to html attributes.

Mainly because I'd synchronisation and includes to work beautifully in editor extensions (e.g. see asciidoctor/asciidoctor-vscode#59)

I guess the use of a template might be outside the scope of the extensions lab.

I don't think there's an easier way to do this than to override the html converter (It would be neat if we could say "add the line number as an attribute to each div element" but I think Asciidoctor doesn't offer this kind of abstraction/interface at the moment). I'd be very happy to be corrected 😸

@mojavelinux mojavelinux deleted the branch asciidoctor:master March 4, 2022 11:37
@mojavelinux mojavelinux closed this Mar 4, 2022
@mojavelinux
Copy link
Member

I do think this is interesting. My worry is that the line information in Asciidoctor is not always perfectly accurate and this could lead to confusion if people start relying on it. On the other hand, it's what most IDE plugins are doing right now anyway. Some I'm a bit torn on this one.

There is a way to override the converter without introducing a template. If that change were made, I might be more inclined to accept it. See https://docs.asciidoctor.org/asciidoctor/latest/convert/custom/#extend-and-replace-a-registered-converter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants