Skip to content

Plus signs are not properly escaped in AsciiDoc #10385

@gavinwahl

Description

@gavinwahl

Pairs of plus signs are used to indicate an "Inline Passthrough" in asciidoc.

$ pandoc --version
pandoc 3.1.3
$ echo 'I use [Notedpad++](http://example.com/) to write C++' | pandoc -f markdown -t asciidoc

Current output:

I use http://example.com/[Notedpad++] to write C++

Correct output:

I use http://example.com/[Notedpad{plus}{plus}] to write C{plus}{plus}

Here is how asciidoc renders the current incorrect output:
image

Here is how it should look:

image

(renderings done with the editor at https://asciidoc.org/)

As far as I can tell the escaping needs to be done for Text and [inline] Code AST nodes. CodeBlock must not be escaped.

I tried to write a lua filter to do this:


function Str (str)
  str.text = str.text:gsub('+', '{plus}')
  return str
end

-- this is an inline code. Standalone code blocks don't need escaping
function Code (code)
  code.text = code.text:gsub('+', '{plus}')
  return code
end

However, pandoc [correctly] escapes the { with a backslash so you get literal {plus} in the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions