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

source highlighter should get unadulterated string #721

Closed
gdamore opened this issue Jul 12, 2020 · 3 comments · Fixed by #723
Closed

source highlighter should get unadulterated string #721

gdamore opened this issue Jul 12, 2020 · 3 comments · Fixed by #723
Assignees
Milestone

Comments

@gdamore
Copy link
Collaborator

gdamore commented Jul 12, 2020

The content passed to the source highlighter code winds up having entities injected, which confused the output. So when I pass this:

[source,c]
----
#include <stdio.h>

printf("Hello World!\n");
----

I get this:

#include &lt;stdio.h&gt;

printf(&#34;Hello World!\n&#34;);
@gdamore
Copy link
Collaborator Author

gdamore commented Jul 12, 2020

I think the conversion of certain characters to HTML entities is taking place too soon.

@xcoulon xcoulon added this to the v0.5.0 milestone Jul 12, 2020
@gdamore
Copy link
Collaborator Author

gdamore commented Jul 12, 2020

We're getting the content post-processed -- i.e. after renderElements().

My guess is that this also clobbers callouts - but I'm not 100% certain yet.

@gdamore
Copy link
Collaborator Author

gdamore commented Jul 13, 2020

Definitely callouts were not functional with syntax highlighting. Fixing this will fix that, although the fix is a bit tricky. PR incoming.

gdamore added a commit to gdamore/libasciidoc that referenced this issue Jul 13, 2020
Ths fix for this involved some refactoring of the highlighting work
to separate out the calloouts (we embed them using reserved Unicode so
that we can find them again and replace them inline).

Chroma automatically escapes the code for HTML safetly already, so
we defer to it's rules, when we use it.  We still have to do this
ourselves when not using Chroma.

Fixes bytesparadise#721
xcoulon pushed a commit that referenced this issue Jul 14, 2020
This fix for this involved some refactoring of the highlighting work
to separate out the callouts (we embed them using reserved Unicode so
that we can find them again and replace them inline).

Chroma automatically escapes the code for HTML safely already, so
we defer to it's rules, when we use it.  We still have to do this
ourselves when not using Chroma.

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

Successfully merging a pull request may close this issue.

2 participants