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

Draft: Render markdown by converting through asciidoc with pandoc #1439

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gavinwahl
Copy link
Collaborator

Use pandoc to convert markdown to asciidoc, then convert the asciidoc to html using asciidoctor.

This has what I consider to be a blocking bug that would only be fixable in the upstream pandoc. Whenever there are multiple instances of ++ on the same line, asciidoc interprets the text in between pairs of ++ to be a "inline passthrough". This makes it hard to use asciidoc to talk about C++, requiring special workarounds.

This mangles, for example, the atomic readme.

Correct, current rendering:
image
Incorrect, rendering in this PR:
image
Notice how the link text is not correct and it says C and C11 instead of C++ and C++11.

Here is a minimal repro using the editor at asciidoc.org:
image

It is probably a bug in pandoc that the ++ are not getting escaped. There are multiple open issues in pandoc around weird asciidoc escaping that seem similar, for example jgm/pandoc#2337. We could consider trying to fix the issue in pandoc, but it'd probably take me at least several days to understand the code.

To see the results on staging, someone will have to clear the rendered content cache. Alternatively, I could change the cache key used for rendered readmes.

Fixes #1328

Use pandoc to convert markdown to asciidoc, then convert the asciidoc to
html using asciidoctor.

Fixes #1328
@vinniefalco
Copy link
Member

Can you preprocess the md file and escape the "++" yourself, so pandoc doesn't mess it up?

@gavinwahl
Copy link
Collaborator Author

Not without breaking other things because escaping is context dependent:

C++ should be escaped here in regular text
```
C++ should not be escaped here in a code block
```

The only way to robustly do it is to fully parse the markdown into an abstract syntax tree, which is the approach pandoc takes.

@vinniefalco
Copy link
Member

I don't have answers unfortunately...

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

Successfully merging this pull request may close these issues.

convert .md to .adoc
2 participants