-
Notifications
You must be signed in to change notification settings - Fork 172
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
Syntax Highlighter #826
Syntax Highlighter #826
Conversation
Syntax highlighter is the correct term. I address this question in the docs. https://asciidoctor.org/docs/user-manual/#enabling-source-highlighting |
The correct term here is "server-side syntax highlighter" (whereas the converse is "client-side syntax highlighter"). I'd also consider "build-time" instead of "server-side" as technically the document could be converted on the client. If you have other suggestions, I'm open to it. |
Yes, I think it should be separate as it's really a different concern. This is more about augmenting the capabilities of the processor than it is about the document itself. I also don't think you need to add the "Java" prefix to the registry. It's well understood given this is a Java API that what you are registering is a Java-based syntax highlighter. I don't really see a need for integrating Ruby-based syntax highlighters this way as it can already be handled using the require option. |
Oh yes, I forgot about |
Added support for writing stylesheet to disk. |
c0e6370
to
974ec4f
Compare
Added support for server side highlighters.
These 3 interfaces have no formal relation in terms of inheritance, because that would require to create all combinations, or have unused, useless default implementations. The naming is bad, I know, and I suck at it. I am happy to use any other name than The last missing functionality imo is to allow implementing |
You're off to a great start!
I would name this
Perhaps name this Another idea would be
I would then rename this to Hopefully those suggestions help with the naming.
Correct. Another term for it would be "layout". |
Thank you, @mojavelinux! That's great input! You mentioned |
I was thinking about making this experimental at first until we get some user feedback. That said I think the test suite should also try to reimplement rouge, coderay, etc adapters to prove that the API works. |
Added an interface |
You could also consider Formatter, which is a word. |
a9aca76
to
1a082c7
Compare
I removed the For now I'd like to keep this API as experimental. Wrt OSS this was probably my most productive PTO ever 😂 |
My understanding is that as long as you clearly mark an API as experimental (or prerelease), and it's a new API, you can continue to make changes to it without impacting the semver rules of the whole. You have essentially sectioned off a portion of the API as "alpha" and can then continue to change that API without warning. |
One thing about the API that I might want to change is that I currently use the |
I don't think it's a bad thing to couple them (unless you are worried about modularity). Technically, the refer to the same concept. It's a property that belongs to docinfo. So maybe it should be promoted to the core package (since it's not limited to extensions per say). |
My initial thinking went into the other direction: Move syntax highlighting to extensions, therefore my initial question about whether to create an own syntax highlighter registry or add it as a new extension type. In hindsight moving it to core sounds like the right way. |
Updated the PR with addition to the integrator guide: Added an example for how to do static, or server-side, syntax highlighting. |
That works too. |
Correct. |
Updated the integrator guide to generate the documentation about the invocation order of the methods of a syntax highlighter. For me the PR could be merged now unless there is more feedback. |
That means, we still need a services interface to allow auto registration of syntax highlighters. |
I'll try to release AsciidoctorJ 2.1.0 in the next days. |
These are still the very first baby steps, but still I'd like to open a PR to discuss some things.
This PR currently only supports Syntax Highlighters that add doc info to the header or footer.
"Converting Highlighters" are not supported yet.
There are a few questions though:
source-highlighter
.Currently the plan is to have a base interface
SyntaxHighlighter
that can be implemented to add any DocInfo.Then a user should be able to implement a sub interface
ConvertingSyntaxHighlighter
which adds the methods for transforming the source blocks directly.