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

Passthrough block macro syntax breaks if include macro is inside with css #194

Open danyill opened 4 years ago

danyill commented 4 years ago

Description

If an include macro is used within a pass-through block with the macros substitution enabled, the syntax highlighter will not finish correctly and the remainder of the document will not be highlighted correctly.

This was noticed in the VS Code Asciidoctor extension (see this issue) which recently switched to using this very fine language pack :heart_eyes:

The example given there is not entirely correct but I believe the OP may be correct with some modifications.

Screenshots

image

Syntax example

The following is valid Asciidoc (at least it is handled correctly by the processor but the docs don't appear to agree):

[subs="+macros"]
++++
<style>
include::file.adoc[]
</style>
++++

but the include macro definition which is not valid css prevents it from being highlighted correctly.

I realise this is probably a tricky and potentially difficult, maybe impossible case to support without defining the include in all languages (?)

mojavelinux commented 4 years ago

FYI include is not a macro, it's a preprocessor directive. The subs attribute has no affect on the behavior of the include directive. It will be processed irrespective of the subs setting. The only way to disable it is to prefix it with a backslash.