Literal asterisk in the beginning of the line in asciidoc to html conversion
Asked Answered
E

2

10

AsciiDoc source like a * a is converted to HTML as normal text "a * a". If the asterisk is the first non-space character in the line, it starts a list (this is normal). However, I need to start a paragraph with literal asterisk. I tried the following to escape it:

  • `*`
    • * (rendered inside <code>)
  • \*
    • \* (rendered as normal text but with backslash present)
  • +*+
    • * (rendered inside <code>)
  • pass::[*]
    • error: block macro cannot occur here: pass::[*]
  • '*'
    • * (rendered inside <em> — the closest to what I need so far)

How to specify an asterisk in the beginning of the line in AsciiDoc source so that it appears as normal text in the HTML output?

Ecology answered 5/12, 2016 at 10:29 Comment(0)
E
16

It turned out that for inline passthroughs a different form of pass is required. I also checked the solution suggested by @Mario Lopez. I summarize the options below:

  • passthrough:
    • pass:[*]
    • +++*+++
    • $$*$$
  • disturb list pattern
    • {empty}* ("official" solution from FAQ)
    • *text
    • *{sp}
  • HTML escapes
    • &#42;
    • &#x002A;
Ecology answered 7/12, 2016 at 8:44 Comment(0)
A
5

You have two options that I know of. The pattern that converts it to a list is specifically an asterisk followed by a space.

* item

Which will get rendered like this:

  • item

You could either omit the space or use the space attribute.

*item
*{sp}item

Which will get rendered like this (respectively):

*item
* item

More information about attributes and substitutions can be found here: http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions

Adrieneadrienne answered 6/12, 2016 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.