Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plus signs are not properly escaped in AsciiDoc #10385

Open
gavinwahl opened this issue Nov 14, 2024 · 2 comments
Open

Plus signs are not properly escaped in AsciiDoc #10385

gavinwahl opened this issue Nov 14, 2024 · 2 comments
Labels

Comments

@gavinwahl
Copy link

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.

@gavinwahl gavinwahl added the bug label Nov 14, 2024
@silby
Copy link
Contributor

silby commented Nov 14, 2024

It looks like from the docs that a literal + in asciidoc might as well always be emitted as {plus}, is that accurate?

@gavinwahl
Copy link
Author

I think so, except CodeBlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants