diff --git a/autotests/folding/asciidoc.adoc.fold b/autotests/folding/asciidoc.adoc.fold --- a/autotests/folding/asciidoc.adoc.fold +++ b/autotests/folding/asciidoc.adoc.fold @@ -1,4 +1,4 @@ -= AsciiDoc Syntax Highlighting += AsciiDoc Syntax Highlighting // There are multiple level 0 sections, so use book instead of article. :doctype: book // For nice admonition and callout icons. @@ -11,12 +11,12 @@ Further sections are intended for testing the supported features of AsciiDoc. -= Known Not to Work += Known Not to Work There are a couple of things that are known not to work. -== Block +== Block * Highlighting of attributes inside a block title. @@ -34,50 +34,50 @@ * Multiple lines of meta data. + .For delimited blocks, Asciidoctor supports something like this: ------ +----- [source] [, options="nowrap"] ---- puts 'hello' ---- ------ +----- + Syntax highlighting does not recognize the additional meta data lines and will rather interpret this as a contiguous block. * https://asciidoctor.org/docs/user-manual/#discrete-headings[Discrete headings] inside block. + ------ +----- **** Some text. [discrete] === Discrete Heading Some more text. **** ------ +----- + Syntax highlighting does not recognize discrete headings inside a block. If a normal section title is marked as being discrete, highlighting works. -== Custom Styles +== Custom Styles * Highlighting of formatted text within the phrase to be styled. + Some [big]#big and *strong*# text. * Highlighting of styles with a phrase that spans multiple lines. + ----- +---- [big]#this is not highlighted# ----- +---- -== Formatted/Quoted Text +== Formatted/Quoted Text * Highlighting of formatted/quoted text (e.g. monospaced) that spans multiple lines. @@ -105,37 +105,37 @@ And even more complex combinations. -== List +== List * Inside a list, indented lines without leading asterisks or hyphen start highlighting for a verbatim paragraph. Asciidoctor renders this as normal text. -== Macro +== Macro * Highlighting of macros with a text argument that spans multiple lines. + ----- +---- xref:id[this works just fine] xref:id[ highlighting a macro with a text that spans multiples does not work ] ----- +---- -== Quote, Verse +== Quote, Verse * Highlighting for single quote symbol `"`. + Highlighting for air quotes `""` is supported. * Highlighting for Markdown style quotes. -== Replacement +== Replacement Highlighting for replacements is limited to those listed in the https://asciidoctor.org/docs/user-manual/#replacements[Asciidoctor Manual] and numerical character references. @@ -151,7 +151,7 @@ * `+φ+` resulting in φ -== Section +== Section * Setext style for section titles. + @@ -163,12 +163,8 @@ ** #marked# ** `monospaced` -* Code folding. -+ -Attempts made so far delivered unsatisfactory results. - -== Table +== Table * Highlighting of tables with custom separator. ** The custom separator will _not_ be highlighted. @@ -185,16 +181,16 @@ -= Admonition += Admonition -== Simple Format +== Simple Format NOTE: A simple note. -//// +//// FIXME: In the paragraph below is no note as it is started in the middle of the paragraph. This is problematic as we would need to know that the note line is not the first line in the paragraph. -//// +//// Some text. NOTE: This is not a separate note as it is part of the paragraph started with the line above. @@ -225,7 +221,7 @@ WARNING: This is a WARNING. -== Block Format +== Block Format .Contiguous [NOTE] @@ -241,27 +237,27 @@ .Delimited [NOTE] [[delimited-note-id]] -==== +==== This is a *note* in block format. As a block, the note may have a title // comment inside block In block format, multiple lines, paragraphs etc. are possible. -==== +==== There is no delimited admonition block without block name. Using `====` delimiter without a block name results in an example block. .Using open block [NOTE] --- +-- Inside the open block note. --- +-- -= [[main-1]]An[[main-2]]chor[[main-3]] and Cross Reference += [[main-1]]An[[main-2]]chor[[main-3]] and Cross Reference -== [[section-1]][[section-2]] An[[section-3]][[section-4]]chor[[section-5]] +== [[section-1]][[section-2]] An[[section-3]][[section-4]]chor[[section-5]] [[isolated-anchor]] Isolated anchor. @@ -289,7 +285,7 @@ Also not after the closing `]`. -=== Not an anchor +=== Not an anchor [[ not-an-anchor]] because of the space after the opening brackets. @@ -314,7 +310,7 @@ Also [#not-an-anchor]because of missing referred text (e.g. `#some text#`). -=== Escaped +=== Escaped This is an escaped \[[anchor-id, some #anchor# label]] anchor. @@ -324,13 +320,13 @@ \[[anchor-id]] -//// +//// FIXME: highlighting differs Asciidoctor seems to just pass through the anchor when escaping it. This behaviour is rather unexpected, as in other cases the escaped contents is subject to further highlighting. We currently only consume the opening bracket. -//// +//// This is an escaped \[#shorthand-id]#anchor in shorthand form#. Some \[#shorthand-id]. @@ -340,7 +336,7 @@ \[#shorthand-id]# -== Cross References +== Cross References <> @@ -371,22 +367,22 @@ <> -=== Escaped +=== Escaped This is not a reference \<>. -= Attribute += Attribute -== No Value +== No Value :some-attribute: This line should not be highlighted. :not-an-attribute: as the line is indented. -== Single Line Value +== Single Line Value Attributes with values that are rendered as a single line, even if their definition spans multiple lines. @@ -413,7 +409,7 @@ text -== Multi Line Value +== Multi Line Value Attributes with values including hard line breaks. @@ -427,7 +423,7 @@ ##before##{multi-line}##after## -== Inline Definition +== Inline Definition Inline attribute definitions {set:inline-attribute:just fine} works {inline-attribute}. @@ -442,7 +438,7 @@ {single-line:some value} -== Unsetting +== Unsetting :!_custom_2-: :_custom_2-!: @@ -455,25 +451,25 @@ {some-attribute} is not set anymore. -== Not an Attribute +== Not an Attribute :not-an-attribute:as there is no space after the terminating column of the identifier :not-an-attribute: as it is indented -== Combination with Other Highlighting +== Combination with Other Highlighting -**** +**** :inside-a-block: inside a block Using an attribute {inside-a-block} works too. -**** +**** :inside-formatting: inside formatting An attribute used `{inside-formatting}` is not highlighting as attribute. -== Escaped +== Escaped \:attr-1: escaped attribute definition + \ second line of escaped attribute definition @@ -490,15 +486,15 @@ This is not an inline attribute definition \{set:attr-2:some other attribute}. + {attr-2} is not set. -**** +**** :inside-a-block: inside a block Escaping an attribute \{inside-a-block} works too. -**** +**** -= Bibliography += Bibliography -== Using References +== Using References The first reference has no label, so its id <> is rendered. @@ -515,7 +511,7 @@ [bibliography] -== References +== References - [[[ref-1]]] This is reference 1. - [[[r2,2]]]This is reference 2. @@ -526,7 +522,7 @@ * [[[r6,strange]]] Using an asterisk yields a strange result. -= Block += Block [abstract] .Abstract - contiguous block @@ -536,40 +532,40 @@ [abstract] .Abstract - delimited open block --- +-- Using the delimited block form ... enables having empty lines in the abstract. --- +-- -== General +== General NOTE: Starting and ending delimiter must be balanced, meaning they must have the same length. .Block title #before# block meta data [literal] -.... +.... Inside the block. -.... +.... [literal] .Block title `after` block meta data -.... +.... Inside the block. -.... +.... .Invalid block name [ literal] -.... +.... This block has invalid meta data as there is a space between the opening square bracket and the block name. -.... +.... .Block with attributes [literal, some, attributes] -.... +.... Inside the block. -.... +.... .Anchor before block name for contiguous block [[contiguous_block_id_before_name]] @@ -584,9 +580,9 @@ .Anchor after block name for delimited block [literal] [#delimited_block_id] -.... +.... Inside the block. -.... +.... .Option definition [literal%some-option, some, attributes] @@ -604,17 +600,17 @@ Link to <>. -== Admonition +== Admonition See `admonition.adoc`. -== Comment +== Comment See `comment.adoc`. -== Example +== Example .Contiguous [example] @@ -630,44 +626,44 @@ // some comment [[example-block-id]] // some comment -==== +==== // some comment Inside the delimited example block. -==== +==== .Delimited without block name [[example-block-id]] -==== +==== Inside the delimited example block. -==== +==== .Using an open block [example] [[example-block-id]] --- +-- Inside the open block example. --- +-- -== Fenced +== Fenced NOTE: According to the https://asciidoctor.org/docs/user-manual/#built-in-blocks-summary[Asciidoctor manual], fenced blocks do not support block names. .Delimited without block name [#fenced-block-id] -``` +``` Inside the fenced block. The block contents is rendered verbatim. So there is *no* text formatting. -``` +``` .This is not a fenced block `````` A fenced block's delimiter length is _exactly_ 3. `````` -== Listing +== Listing .Contiguous [listing] @@ -681,29 +677,29 @@ [listing] [[listing-block-id]] // comment before the opening block delimiter -//// +//// block comment -//// ----- +//// +---- First line inside the *listing* block. Last line inside the block. ----- +---- .Delimited without block name [[listing-block-id]] ----- +---- Inside the delimited listing block. ----- +---- .Using an open block [listing] [[listing-block-id]] --- +-- Inside the open block listing. --- +-- -== Literal +== Literal .Contiguous [literal] @@ -724,50 +720,50 @@ // some comment [#literal-block-id] // some comment -.......... +.......... Inside the delimited literal block. // this should not be highlighted as comment .this should not be highlighted as title -.......... +.......... .Delimited without block name [[literal-block-id]] // some comment -.......... +.......... Inside the delimited literal block. -.......... +.......... .Using an open block [literal] // some comment [[literal-block-id]] // some comment --- +-- // this should not be highlighted as comment Inside the open block listing. --- +-- .Using leading spaces for first line When using some leading spaces, the whole paragraph is treated as literal. Only the first line needs to have leading spaces. This line is not part of the literal paragraph anymore. -== Open +== Open NOTE: The open block does not have a contiguous form. .Delimited [#open-block-id] --- +-- An open block's delimiter length is _exactly_ 2. Last line of the #open# block. --- +-- -== Passthrough +== Passthrough .Contiguous [pass] @@ -780,25 +776,25 @@ .Delimited with block name [pass] [[delimited-passthrough-id]] -++++++ +++++++ Inside the delimited passthrough block with block name. -++++++ +++++++ .Delimited without block name [[delimited-passthrough-id]] -++++ +++++ Inside the delimited passthrough block without block name. -++++ +++++ According to the https://asciidoctor.org/docs/user-manual/#built-in-blocks-summary[Asciidoctor Manual], passthrough using an open block is not supported. -== Quote +== Quote See `quote_verse.adoc`. -== Sidebar +== Sidebar .Contiguous [sidebar] @@ -811,25 +807,25 @@ .Delimited with block name [sidebar] [[sidebar-block-id]] -********** +********** Inside the *sidebar* block. -********** +********** .Delimited without block name [[sidebar-block-id]] -**** +**** Inside the sidebar block. -**** +**** .Using an open block [sidebar] [[sidebar-block-id]] --- +-- Inside the sidebar block. --- +-- -== Source +== Source .Contiguous [source,ruby] @@ -849,43 +845,43 @@ .Delimited with block name [source , ruby ] [[source-block-id]] ----- +---- # This is Ruby source code. # NOTE: in delimited source blocks, having a space after the `#` in the comment is OK. import 'needed' IO.puts "hello" ----- +---- .Delimited with block name using option syntax [source%mixed,php] ----- +----

----- +---- .Delimited without block name [[source-block-id]] ----- +---- # This is Ruby source code. # NOTE: in delimited source blocks, having a space after the `#` in the comment is OK. import 'needed' IO.puts "hello" ----- +---- .Using an open block [source,ruby] [[source-block-id]] --- +-- import 'needed' IO.puts "hello" --- +-- -== Stem +== Stem .Contiguous [stem] @@ -898,23 +894,23 @@ .Delimited with block name [stem] [[stem-block-id]] -++++++ +++++++ Inside the delimited stem block with block name. -++++++ +++++++ .Delimited without block name [[stem-block-id]] -++++ +++++ Inside the delimited stem block without block name. -++++ +++++ -== Table +== Table See `table.adoc`. -== Verse +== Verse .Contiguous [verse] @@ -927,60 +923,60 @@ .Delimited with block name [verse] [[verse-block-id]] -____ +____ Inside the *verse* block. -____ +____ .Delimited without block name This would be rendered as a quote block as the same delimiters are used. .Using an open block [verse] [[verse-block-id]] --- +-- Inside the *verse* block. --- +-- -== Nested Blocks +== Nested Blocks -==== +==== Start of outer example block. .Nested example block -===== +===== Inside the inner example block. // some comment .Nested literal block [literal] // some comment ----- +---- Inside the literal block within the inner example block. -- Trying to use a block within a verbatim block results in verbatim text, of course. -- ----- -===== +---- +===== Line in outer block. [listing] ----- +---- Inside the inner listing block. ----- +---- End of outer block. -==== +==== .Admonition inside some other block -==== +==== Some text. NOTE: This is a note in simple format inside a block. Some more text. -==== +==== -= Callout += Callout // Add `:icons: font` for nice callout icons. Callouts are usually used with listing/source blocks, but Asciidoctor renders them also without a listing block. @@ -994,39 +990,39 @@ <3> -//// +//// FIXME This should not be highlighted as callout. As it depends on the kind of line before, this is problematic. -//// +//// The line below is not rendered as callout as it is part of this paragraph. <4> This should _not_ be highlighted as callout. .Callouts with manual numbering [source,sh] ----- +---- ls -l <2> ls -la <1> ----- +---- <1> Explanation for callout number 1. <2> Explanation for callout number 2. \<3> This is not a callout as it is escaped. .Callouts with automatic numbering [source,sh] ----- +---- ls -l <.> ls -la <.> ----- +---- <.> Explanation for callout number 1. <.> Explanation for callout number 2. -= Comment += Comment TIP: Comment highlighting supports the standard https://cgit.kde.org/syntax-highlighting.git/tree/data/syntax/alert.xml[KDE alerts] (TODO, FIXME, ...) in both single-line and multi-line comments. -== Single Line +== Single Line Single-line comments start with exactly `//`. If there are any characters - including spaces - before the `//`, the line will be rendered. @@ -1058,7 +1054,7 @@ // DANGER: testing alerts -== Multi Line +== Multi Line .Contiguous block [comment] @@ -1076,7 +1072,7 @@ This line is not part of the contiguous block comment anymore. .Delimited block without name -////// +////// This is a multi-line comment. It spans multiple lines. @@ -1090,11 +1086,11 @@ DANGER: testing alerts This is the comment's last line. -////// +////// [comment] .Delimited block with name -//// +//// This is a multi-line comment. It spans multiple lines. @@ -1108,18 +1104,18 @@ DANGER: testing alerts This is the comment's last line. -//// +//// .Using open block [comment] -- Inside the open block comment. -- -= Counter += Counter -== Use and Render +== Use and Render .Start with 1 and render value New value for `c1` is {counter:c1}. @@ -1131,7 +1127,7 @@ Current value is {c1}. -== Use Without Rendering +== Use Without Rendering .Define the new counter No new value to be {counter2:c2}seen. @@ -1146,7 +1142,7 @@ Current value is {c2}. -== Using a Start Value +== Using a Start Value .Start with 3 and render value New value for `c3` is {counter:c3:99}. @@ -1161,7 +1157,7 @@ And now it is {counter:c4}. -== About using Spaces +== About using Spaces CAUTION: If you leave spaces after the `:` or before the closing `}`, Asciidoctor will make them part of the counter attribute name. + So it's probably wise to avoid spaces here. @@ -1195,11 +1191,11 @@ -= Text Formatting += Text Formatting TIP: Asciidoctor uses also the term _quoted text_. -== Custom Styles +== Custom Styles [big]#big text# @@ -1217,11 +1213,11 @@ [big]##*text*## -//// +//// FIXME Highlighting differs. The phrase is rendered as marked. The trailing hash is therefore not visible. -//// +//// [big]###text### [fo[o]#some text# @@ -1242,7 +1238,7 @@ [underline]**strong and underlined** -=== Not rendered as custom style +=== Not rendered as custom style [fo]o]#not a custom style# because of surplus `]`. @@ -1259,14 +1255,14 @@ Before [foo]#the phrase#after because of missing non-word character after clause. -=== Escaped +=== Escaped This is not \[underline]#underlined text#. -== Emphasized +== Emphasized -=== Rendered formatted +=== Rendered formatted This line contains a _sequence_ of _multiple emphasized_ words. @@ -1299,7 +1295,7 @@ aa__ bb __cc -=== Rendered as-is +=== Rendered as-is This line does not contain _some emphasized _ text as there is a surplus space. @@ -1319,16 +1315,16 @@ That is a bit strange. -=== Escaped +=== Escaped Not \_emphasized_ as it is escaped. Still \__emphasized__ as only the outermost level is escaped. -== Marked +== Marked -=== Rendered formatted +=== Rendered formatted Some # marked # text. @@ -1354,7 +1350,7 @@ ##marked## -=== Rendered as-is +=== Rendered as-is Not rendered # marked# because of space after the leading hash. @@ -1371,16 +1367,16 @@ Some [big]##big marked## text. -=== Escaped +=== Escaped Not \#marked# as it is escaped. Still \##marked## as only the outermost level is escaped. -== Monospaced +== Monospaced -=== Rendered formatted +=== Rendered formatted This line contains a `sequence of ` multiple monospaced` words. @@ -1413,7 +1409,7 @@ aa`` bb ``cc -=== Rendered as-is +=== Rendered as-is Not rendered ` monospaced` because of leading space. @@ -1424,16 +1420,16 @@ Not rendered `monospaced`as there is a space missing. -=== Escaped +=== Escaped Not \`monospaced` as it is escaped. Still \``monospaced`` as only the outermost level is escaped. -== Passthrough +== Passthrough -=== Rendered passed through +=== Rendered passed through This text is +passed _as_ is+ with no further formatting. @@ -1453,7 +1449,7 @@ This text is +++passed _as_ is+++ with no further formatting. -=== Rendered as-is +=== Rendered as-is No+passthrough+ as there is no space before the leading `+`. @@ -1464,18 +1460,18 @@ No +passthrough + as there is a space after the trailing plus. -=== Escaped +=== Escaped This text \+is _not_ passed through+ because of escaping. This text \++is _still_ passed through++ as only the outermost level is escaped. This text \+++is _still_ passed through+++ as only the outermost level is escaped. -== Strong +== Strong -=== Rendered formatted +=== Rendered formatted This line contains a *sequence of * multiple strong* words. @@ -1510,7 +1506,7 @@ aa** bb **cc -=== Rendered as-is +=== Rendered as-is This line does _not_ contain *some strong * text as there is a space before the trailing asterisk. @@ -1534,54 +1530,54 @@ That is a bit strange. -=== Escaped +=== Escaped Not \*strong* as it is escaped. Still \**strong** as only the outermost level is escaped. -== Subscript +== Subscript -=== Rendered formatted +=== Rendered formatted H~2~O -=== Rendered as-is +=== Rendered as-is Not rendered sub~sc ript~ as there is a space within. -=== Escaped +=== Escaped Not \~subscript~ as it is escaped. -== Superscript +== Superscript -=== Rendered formatted +=== Rendered formatted E = m c^2^ -=== Rendered as-is +=== Rendered as-is Not rendered super^sc ript^ as there is a space within. -=== Escaped +=== Escaped Not \^superscript^ as it is escaped. -== Combinations +== Combinations IMPORTANT: Combinations are supported by Asciidoctor, as long as the markup sets are entered in the right order. The monospace markup must be the outermost set, then the strong set, and the emphasized markup must always be the innermost set. -=== Rendered formatted +=== Rendered formatted This is *_strong emphasized_* text. @@ -1627,7 +1623,7 @@ `*_strong emphasized monospaced_*` -=== Unsupported +=== Unsupported Highlighting for other combinations is currently not supported, as there would be a large number of rules and styles necessary. @@ -1649,7 +1645,7 @@ And even more complex ones. -=== Rendered as-is +=== Rendered as-is This is no *_ strong emphasized_* text, it's *strong* only. @@ -1660,7 +1656,7 @@ This is no _`emphasized monospaced`_ text, it's _emphasized_ only. -=== Escaped +=== Escaped This is not rendered \`_emphasized monospaced_`. + But it is rendered emphasized. @@ -1675,56 +1671,56 @@ But it is rendered emphasized strong. -= Horizontal Rules += Horizontal Rules -== Simple patterns +== Simple patterns ''' --- *** -== Patterns with spaces +== Patterns with spaces - - - * * * .Not a horizontal rule ' ' ' -== Arbitrary length +== Arbitrary length NOTE: Although the https://asciidoctor.org/docs/user-manual/#markdown-style-horizontal-rules[Asciidoctor Manual] states that horizontal rule patterns are only supporting up to three characters (ignoring the optional spaces), some longer patterns work too. ''''''' -//// +//// These patterns don't work, as they start delimited blocks, item lists etc.. -------- ****** - - - - - - * * * * * * * * * -//// +//// -== Inside blocks +== Inside blocks -**** +**** Horizontal rules work also inside blocks. They eventually need an empty line before them, though. ''' After the horizontal rule. -**** +**** -= Include += Include :includedir: include -== Included Contents Rendered +== Included Contents Rendered -IMPORTANT: The include directive is _always_ processed, even withing passthrough blocks. +IMPORTANT: The include directive is _always_ processed, even within passthrough blocks. NOTE: Using file names with spaces works. @@ -1741,18 +1737,18 @@ .Inside delimited block with name [literal] ----- +---- This line shall be highlighted as verbatim. include::{includedir}/demo.adoc[lines=2..3] This line shall be highlighted as verbatim. ----- +---- .Inside delimited block without name -.... +.... This line shall be highlighted as verbatim. include::{includedir}/demo.adoc[lines=2..3] This line shall be highlighted as verbatim. -.... +.... .It is also processed within passthrough blocks [pass] @@ -1768,21 +1764,21 @@ -- .Inside table -|=== +|=== |row 1 col 1|row 2 col 2 | // the include directive must have its own line with nothing else include::{includedir}/demo.adoc[lines=1..1] |row 2 col2 |row 3 col 1 |row 3 col 2 -|=== +|=== -= Index += Index -== Rendered as Index Term +== Rendered as Index Term This is a ((flow)) index term. @@ -1803,16 +1799,16 @@ Some ((((index term)))). -== Rendered as-is +== Rendered as-is This is (()) not an index term as it is empty. This is (not an index term)) as there is a `(` missing. This is ((not an index term) as there is a `)` missing. -== Escaped +== Escaped This is \((not an indexterm)) as it is escaped. @@ -1826,20 +1822,20 @@ [index] -== Index Catalog +== Index Catalog WARNING: HTML output currently does not support the creation of the index catalog. -= Link += Link -== ftp, irc +== ftp, irc * ftp://some.org/some/where/file.extension * irc://some.org/some/where/file.extension -== http(s) +== http(s) * http://some.org/some/where/file.extension * https://some.org/some/where/file.extension @@ -1884,16 +1880,16 @@ * >https://some.org -=== Not rendered as Link +=== Not rendered as Link * {https://some.org * }https://some.org * ,https://some.org * .https://some.org * :https://some.org -== link +== link * link:relative/path - not rendered as link as `[]` are misssing * link:relative/path[] @@ -1907,7 +1903,7 @@ * link:url[optional link text, optional target attribute, optional role attribute] -== E-Mail +== E-Mail * some.person@org.com * some.person@org.com[some one] - brackets supported only with leading `mailto:` @@ -1923,7 +1919,7 @@ * mailto:[some one] - not rendered as link because of missing address -== Escaped +== Escaped * \ftp://some.org/some/where/file.extension * \irc://some.org/some/where/file.extension @@ -1936,14 +1932,14 @@ * \mailto:some.person@org.com[] -= List += List -== Bulleted List +== Bulleted List -//// +//// FIXME The *** without text in the list below should not be highlighted as a horizontal line. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// .using asterisks * item 1 * * item 2 @@ -1972,24 +1968,24 @@ - item 2 -- item 2.1 is not an item as using hyphens is only supported for flat lists -//// +//// FIXME: The line above should not be highlighted as literal. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// .inside a block -**** +**** * item 1 ** item 1.1 -**** +**** -== Checklist +== Checklist -//// +//// FIXME The invalid checklist items below should not be highlighted as bulleted list items. This is going to be problematic, as we would need to know that we are currently inside a checklist. -//// +//// .using asterisks * [*] checked @@ -2007,13 +2003,13 @@ -- [*] _not a list item_ as hyphens are only supported for flat lists -- [*] _not a list item_ as hyphens are only supported for flat lists -//// +//// FIXME: the line above should not be highlighted as literal. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// -== Description List +== Description List .Normal format Term normal:: This is a description. @@ -2037,19 +2033,19 @@ .;Strange Term = !?*:: This one has a strange term. Term 9 : : A space between the double `:` does _not_ work. -//// +//// FIXME The line with the "Strange Term" abvoe should not be highlighted as title in this case. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// .Term and description on the same line [horizontal] Term 1:: first level. Term 2::: second level. Term 3:: first level again. -== Numbered List +== Numbered List .using numbers 1. item 1 @@ -2070,18 +2066,18 @@ .... item 2.2.1.1 . item 3 -//// +//// FIXME The line above starting with "..not an item" should not be highlighted as title in this case. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// -== Question and Answer List +== Question and Answer List -//// +//// FIXME Indented answer is highlighted as verbatim block, messing up further question. This is going to be problematic, as we would need to know that we are currently inside a list. -//// +//// [qanda] What is Asciidoctor?:: @@ -2091,27 +2087,27 @@ What is the answer to the Ultimate Question?:: 42 -= Macro += Macro // for `btn:`, `kbd:`, `menu:` :experimental: // for icon:tags[] etc. :imagesdir: media // needed to use macro `toc::[]` :toc: macro -== General Information +== General Information NOTE: There is no space needed before the macro name or after the closing `]`. -== Anchor +== Anchor There is a macro form anchor:anchor-id[Macro Anchor] for anchor definition. See `anchor.adoc` for other forms. -== Cross Reference +== Cross Reference xref:anchor-id[macro xref] @@ -2125,61 +2121,61 @@ \xref:anchor-id[macro xref] escaped -== Footnote +== Footnote This text has a foonotefootnote:[A simple footnote.]. This text has a foonote with idfootnoteref:[fn-1, A footnote reference.]. -== Icon +== Icon This is a tag icon:tags[] icon with no color set. This is a blue icon:tags[role="blue"] tag. This is a big green icon:tags[role="green", size="2x"] tag. -== Image +== Image An imageimage:logo-outline-color.svg[Logo,25]within some text. -== Keyboard Shortcut +== Keyboard Shortcut kbd:[Ctrl+M] -== Menu Selection +== Menu Selection menu:File[Save] menu:View[Zoom > 1:1] -== Pass +== Pass -// TODO Would be nice to highlight the text within the square bracktes as passthrough. +// TODO Would be nice to highlight the text within the square brackets as passthrough. Some pass:[passthrough] HTML. Some pass:quotes[passthrough with *quoted* text] HTML. Some pass:q[passthrough with *quoted* text] HTML. -== Table of Contents +== Table of Contents toc::[] -== UI Buttons +== UI Buttons Press the btn:[OK] button when you are finished. -== Escaped +== Escaped This is no anchor \anchor:macro-anchor[Macro Anchor]. @@ -2200,11 +2196,11 @@ This is no passthrough \pass:[passthrough]. -= Media += Media // The name `imagesdir` is a bit misleading as audio and video use also this prefix. :imagesdir: media -== Audio +== Audio audio::test.mp3[] @@ -2214,31 +2210,31 @@ \audio::test.mp3[] -== Image +== Image -=== Block Format +=== Block Format .Test SVG [#logo] [link=https://github.com/asciidoctor/brand] image::test.svg[Test, 100] -==== Not highlighted +==== Not highlighted .leading spaces, literal paragraph image::test.svg[Test, 100] .trailing characters image::test.svg[Test, 100] trailing -==== Escaped +==== Escaped \image::test.svg[Asciidoctor Logo, 100] -=== Inline Format +=== Inline Format Withinimage:logo-outline-color.svg[Tree, 25]some text. @@ -2251,7 +2247,7 @@ (image:logo-outline-color.svg[Tree, 25]) wrapped in non-space characters. -==== Not highlighted +==== Not highlighted image @@ -2264,12 +2260,12 @@ some image:[] -==== Escaped +==== Escaped Within\image:logo-outline-color.svg[Tree, 25]some text. -== Video +== Video video::test.mp4[width=300] @@ -2279,14 +2275,14 @@ \video::test.mp4[] -= Page break += Page break -== Rendered as page break +== Rendered as page break <<< -== Not rendered as page break +== Not rendered as page break .Not a page break as it is indented <<< @@ -2298,9 +2294,9 @@ \<<< -= Preprocessor += Preprocessor -== If Defined +== If Defined :!attr-1: ifdef::attr-1[] @@ -2316,7 +2312,7 @@ ifdef::attr-1[The attribute `attr-1` is defined] -== If Not Defined +== If Not Defined :!attr-1: ifndef::some-attribute[] @@ -2327,7 +2323,7 @@ ifndef::some-attribute[The attribute `attr-1` is _not_ defined] -== Any (or) +== Any (or) :!attr-1: :!attr-2: @@ -2344,7 +2340,7 @@ endif::[] -== None (nor) +== None (nor) :!attr-1: :!attr-2: @@ -2361,7 +2357,7 @@ endif::[] -== All (and) +== All (and) :attr-1: :attr-2: @@ -2378,7 +2374,7 @@ endif::[] -== Not All (nand) +== Not All (nand) :attr-1: :attr-2: @@ -2395,7 +2391,7 @@ endif::[] -== If Eval +== If Eval :two: 2 ifeval::[{two} > 1] @@ -2408,7 +2404,7 @@ endif::[] -== Escaped +== Escaped :!attr-1: \ifdef::attr-1[] @@ -2426,9 +2422,9 @@ \endif::[] -= Quote and Verse += Quote and Verse -== Quote +== Quote .Contiguous block / paragraph [quote, attribution, citation title and information] @@ -2441,39 +2437,39 @@ .Delimited with block name [quote, attribution, citation title and information] [[quote-block-id]] -____ +____ Inside the *delimited block quote*. May contain emtpy lines. -____ +____ .Delimited without block name [[quote-block-id]] -____ +____ Inside the *delimited block quote*. May contain emtpy lines. -____ +____ .Using an open block [quote] [[quote-block-id]] --- +-- Inside the *open block quote*. --- +-- .Nested block quote [quote, outer attribution, outer citation title and information] [[quote-block-id]] -____ +____ First line of outer quote. [quote, inner attribution, inner citation title and information] [[quote-block-id]] -______ +______ Inside the inner quote. -______ +______ Last line of outer quote. -____ +____ // Currently no specific highlighting supported. .Quoted paragraph @@ -2484,11 +2480,11 @@ .Air quote [,attribution, citation title and information] -"" +"" Inside the *air quote*. Supports empty lines. -"" +"" // Currently no specific highlighting supported. .Markdown style @@ -2511,7 +2507,7 @@ > End of outer quote. -== Verse +== Verse .Contiguous block / paragraph [verse, attribution, citation title and information] @@ -2524,31 +2520,31 @@ .Delimited block with name [verse, attribution, citation title and information] [[verse-block-id]] -____ +____ Inside the *delimited block verse*. Supports empty lines. -____ +____ .Delimited block without name This would be rendered as a quote block as the same delimiters are used. .Using an open block [verse, attribution, citation title and information] [[verse-block-id]] --- +-- Inside the *open block verse*. --- +-- -= Replacement += Replacement TIP: See also the https://asciidoctor.org/docs/user-manual/#replacements[corresponding section] in the Asciidoctor manual. -== Textual symbol replacements +== Textual symbol replacements -|=== +|=== |Name |Syntax |Escaped |copyright |(C) |\(C) @@ -2563,10 +2559,10 @@ |right single arrow |-> |\-> |left double arrow |<= |\<= |right double arrow |=> |\=> -|=== +|=== -=== Not replaced +=== Not replaced // Single apostrophe must be surrounded by alphabetic characters. * a' @@ -2576,144 +2572,150 @@ * .'a -== Numerical Character Reference +== Numerical Character Reference -=== Decimal +=== Decimal § ##before##§##after## § -=== Hexadecimal +=== Hexadecimal § ##before##§##after## § -=== Escaped +=== Escaped \§ \§ \§ \§ -== HTML/XML Character Entity References +== HTML/XML Character Entity References See e.g. https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references[Wikipedia]. IMPORTANT: Highlighting of HTML/XML character entity references is _not_ supported. There are just too many of them. // some examples -==== +==== ≠ ≡ -==== +==== -= Section L0 += Section L0 [abstract] -== Abstract +== Abstract This document is used for testing various aspects of syntax highlighting regarding sections. :title-attribute: with attribute -== Section L1 +== Section L1 -=== Section L2 +=== Section L2 -==== Section L3 +==== Section L3 -===== Section L4 +===== Section L4 -====== Section L5 +====== Section L5 ======= This is not a new section The level would be too deep. Only sections up to level 5 (having 6 leading `=`) are supported. -#### Section L3 +#### Section L3 Using Markdown section syntax works too. =#=# This is not a section. Use either `=` or `#`, but not mixed. -===== [[id-1]] [[id-2]] Section L4 +===== [[id-1]] [[id-2]] Section L4 This section has leading additional achors. -==== Section L3 [[id-1]][[id-2]] +==== Section L3 [[id-1]][[id-2]] This section has trailing additional anchors. -==== [[id-1]][[id-2]]Section L3[[id-3]][[id-4]] +==== [[id-1]][[id-2]]Section L3[[id-3]][[id-4]] This section has both leading and trailing additional anchors. -==== Section L3 {title-attribute} in Title +==== Section L3 {title-attribute} in Title .Title {title-attribute} This section has an attribute in its title. [discrete] -== Discrete Section +== Discrete Section This section will not be shown in the table of contents. -//// +//// == Section with _emphasized_ text === Section with escaped \_emphasized_ text -//// +//// -== Section with #marked# text +== Section with #marked# text -=== Section with escaped \#marked# text +=== Section with escaped \#marked# text -== Section with `monospaced` text +== Section with `monospaced` text -=== Section with escaped \`monospaced` text +=== Section with escaped \`monospaced` text -//// +//// == Section with *strong* text === Section with escaped \*strong* text -//// +//// + += Another Section at Level 0 -= Another Section at Level 0 +Some text in the second level 0 section. + +== Section 2.1 + +Some text. -= Table += Table -== Default Separator +== Default Separator .PSV // some comment [[table-1]] [.some-role] [#table-shorthand] // some comment -|=== +|=== // some comment | header col 1 | header col 2 | header col 3 // some comment @@ -2748,46 +2750,46 @@ e|row 10 col 1 is emphasized (italic) s|row 10 col 2 is strong (bold) m|row 10 col 3 is monospaced -|=== +|=== -== Custom Separator +== Custom Separator IMPORTANT: Highlighting of tables with custom separator is not supported. All `|` inside the table will be falsly highlighted. [separator=!] -|=== +|=== // the `|` in the line below should not be highlighted. !row 1 | col 1 !row 1 col 2 s!row 2 col 1 !row 2 col 2 -|=== +|=== [separator=a] -|=== +|=== arow 1 col 1 arow 1 col 2 sarow 2 col 1 arow 2 col 2 -|=== +|=== -== Delimiter-Separated Values +== Delimiter-Separated Values IMPORTANT: Highlighting for tables with delimiter-separated values is not supported. All `|` inside the table will be falsly highlighted. [format=csv] -|=== +|=== Col 1 ,Col 2 ,Col 3 // the `|` in the line below should not be highlighted. row 1 | col 1 ,row 1 col 2 ,row 1 col 3 row 2 col 2,row 2 col 2,row 2 col 3 row 3 col 3 , "row ""3"", col 2" , row 3 col 3 -|=== +|=== -=== Shorthand Notation for Data Tables +=== Shorthand Notation for Data Tables .CSV ,=== diff --git a/autotests/html/asciidoc.adoc.html b/autotests/html/asciidoc.adoc.html --- a/autotests/html/asciidoc.adoc.html +++ b/autotests/html/asciidoc.adoc.html @@ -169,10 +169,6 @@ ** #marked# ** `monospaced` -* Code folding. -+ -Attempts made so far delivered unsatisfactory results. - == Table @@ -1730,7 +1726,7 @@ == Included Contents Rendered -IMPORTANT: The include directive is _always_ processed, even withing passthrough blocks. +IMPORTANT: The include directive is _always_ processed, even within passthrough blocks. NOTE: Using file names with spaces works. @@ -2166,7 +2162,7 @@ == Pass -// TODO Would be nice to highlight the text within the square bracktes as passthrough. +// TODO Would be nice to highlight the text within the square brackets as passthrough. Some pass:[<u>passthrough</u>] HTML. @@ -2708,6 +2704,12 @@ = Another Section at Level 0 +Some text in the second level 0 section. + +== Section 2.1 + +Some text. + = Table diff --git a/autotests/input/asciidoc.adoc b/autotests/input/asciidoc.adoc --- a/autotests/input/asciidoc.adoc +++ b/autotests/input/asciidoc.adoc @@ -163,10 +163,6 @@ ** #marked# ** `monospaced` -* Code folding. -+ -Attempts made so far delivered unsatisfactory results. - == Table @@ -1724,7 +1720,7 @@ == Included Contents Rendered -IMPORTANT: The include directive is _always_ processed, even withing passthrough blocks. +IMPORTANT: The include directive is _always_ processed, even within passthrough blocks. NOTE: Using file names with spaces works. @@ -2160,7 +2156,7 @@ == Pass -// TODO Would be nice to highlight the text within the square bracktes as passthrough. +// TODO Would be nice to highlight the text within the square brackets as passthrough. Some pass:[passthrough] HTML. @@ -2702,6 +2698,12 @@ = Another Section at Level 0 +Some text in the second level 0 section. + +== Section 2.1 + +Some text. + = Table diff --git a/autotests/reference/asciidoc.adoc.ref b/autotests/reference/asciidoc.adoc.ref --- a/autotests/reference/asciidoc.adoc.ref +++ b/autotests/reference/asciidoc.adoc.ref @@ -163,10 +163,6 @@ ** #marked#
** `monospaced`

-* Code folding.
-+
-Attempts made so far delivered unsatisfactory results.
-

== Table


@@ -1724,7 +1720,7 @@
== Included Contents Rendered


-IMPORTANT: The include directive is _always_ processed, even withing passthrough blocks.
+IMPORTANT: The include directive is _always_ processed, even within passthrough blocks.

NOTE: Using file names with spaces works.

@@ -2160,7 +2156,7 @@
== Pass


-// TODO Would be nice to highlight the text within the square bracktes as passthrough.
+// TODO Would be nice to highlight the text within the square brackets as passthrough.

Some pass:[passthrough] HTML.

@@ -2702,6 +2698,12 @@
= Another Section at Level 0


+Some text in the second level 0 section.
+
+
== Section 2.1

+
+Some text.
+

= Table


diff --git a/data/syntax/asciidoc.xml b/data/syntax/asciidoc.xml --- a/data/syntax/asciidoc.xml +++ b/data/syntax/asciidoc.xml @@ -42,8 +42,16 @@ + + + + + + + + ]> - + anchor @@ -64,8 +72,8 @@ - - + + @@ -143,7 +151,7 @@ - + @@ -172,20 +180,72 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + @@ -374,6 +434,17 @@ + + + + + + + + + +