Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Literal asterisk in the beginning of the line in asciidoc to html conversion

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?

like image 529
Andrey Avatar asked Dec 05 '16 10:12

Andrey


People also ask

What is AsciiDoc format?

AsciiDoc is a text document format that was explicitly designed with the needs of publishing in mind, both print and web. It supports all the structural elements necessary for writing notes, documentation, articles, books, ebooks, slideshows, web pages, technical manuals and blogs.

Is AsciiDoc better than markdown?

AsciiDoc uses the same number of markup characters or less when compared to Markdown in nearly all cases. AsciiDoc uses a consistent formatting scheme (i.e., it has consistent patterns). AsciiDoc can handle all permutations of nested inline (and block) formatting, whereas Markdown often falls down.

How do I add notes to AsciiDoc?

Comment syntax You can use a comment line or comment block when you want to add text to an AsciiDoc source file, but don't want that text to be displayed when the file is converted to an HTML page. A comment line is denoted by two consecutive forward slashes ( // ).

How do you use ADOC?

How to open an ADOC file. You can open an ADOC file and edit the text it contains in any text editor, including Microsoft Notepad (Windows), Apple TextEdit (Mac), Microsoft Visual Studio Code (cross-platform), and GitHub Atom (cross-platform).


2 Answers

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;
like image 66
Andrey Avatar answered Sep 20 '22 14:09

Andrey


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

like image 36
Amelia Lopez Avatar answered Sep 20 '22 14:09

Amelia Lopez