asciidoctor / atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
https://atom.io/packages/language-asciidoc
MIT License
42 stars 20 forks source link

Level 4 heading seems to turn off syntax highlighting #118

Closed sengopal closed 8 years ago

sengopal commented 8 years ago

Description

Adding a Level 4 heading turns off the syntax highlighting and shows the text below only in grey. The text above is fine and after removing the ++++++ the highlighting returns. Also tried with different themes with the same result.

Screenshots

screen shot 2016-05-12 at 12 54 58 pm

Syntax example

[[tickets]] Tickets ++++++

ldez commented 8 years ago

Thanks for reporting.

ldez commented 8 years ago

Currently we not support heading with ++++++ syntax.

ldez commented 8 years ago

Related to original Python implementation.

Compatibility mode is currently not supported by this highlighter.

sengopal commented 8 years ago

oh! thats a bummer. is there any means to se the compatibility to unsafe or others in a config?

mojavelinux commented 8 years ago

We only support single-line section titles and discrete headings because we consider the two-line version to be bad practice. (We may even drop this feature in Asciidoctor core at some point).

See http://asciidoctor.org/docs/asciidoc-recommended-practices/#section-titles

I vote that this issue should be marked decline. While it does require updating docs, it's for the best.

mojavelinux commented 8 years ago

The other reason it is bad practice is because it severely breaks the consistent patterns in AsciiDoc, making the grammar even more ambiguous and harder to maintain.

mojavelinux commented 8 years ago

Generally, I like to keep an open mind about things, but the two-line syntax has burned me so many times that I'm quite firm about this path forward.

sengopal commented 8 years ago

: ) I understand the frustration. However, being selective of grammar to support, will hinder the purpose of syntax highlighting which seems to be the primary usage of this plugin. I agree that the support for two-line should be dropped for Snippets. However, for highlighting ignoring the existing grammar does not seem to be good idea, unless there is a version of asciidoc which is released without support for two line in this grammar.

Just my two cents!

mojavelinux commented 8 years ago

Thank you for sharing your perspective.

The point I'm making is that I don't consider the two-line section title to be part of AsciiDoc anymore. Asciidoctor core supports it when compat-mode is on because it has to run in legacy mode for old documents in old builds. But anyone touching an AsciiDoc document these days should not be using the two-line syntax. That's why we don't want to support it in this grammar. It encourages use and we want to discourage use.

nicorikken commented 8 years ago

@sengopal I understand your point, but this heading case in particular is hard to highlight, as the parsing would only know about the heading being a header on the next line. As the highlighting is handled line-by-line, we'd have to do some wizardry to even get this working in most cases. Furthermore we cannot now for sure if the document is indeed rendered with support for compat-mode, and if the syntax is therefore valid. Then we might be highlighting invalid syntax, which also has its downsides.

So in summary: difficult to implement and maybe somewhat hard to maintain, both of which are not ideal for a syntax which is practically considered deprecated.

We do want to make this clear upfront, as you can see by PR #119 to avoid disappointment.

I'm pretty sure this is just the tip of the iceberg of these issues. Maybe the Asciidoctor.rb can provide a conversion method to ease the transition away from legacy code, so that the legacy syntax support can be removed as soon as possible 😉

sengopal commented 8 years ago

I'm pretty sure this is just the tip of the iceberg of these issues. Maybe the Asciidoctor.rb can provide a conversion method to ease the transition away from legacy code, so that the legacy syntax support can be removed as soon as possible 😉

Amen to that! Thanks for this discussion. This definitely helps take the right direction even while creating content and prevent the hassle of converting legacy format.