-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Using custom highlight style (.theme file) not working #6704
Comments
Hm, I cannot reproduce this. Maybe it works on non-windows platforms but not on windows? |
One thing to check would be whether k.theme has CRLF line endings. |
We just use aeson ToJSOn/FromJSON instances to parse and render the styles as themes, so it's hard to see how line endings could be mishandled. But I'm at a loss as to what else could be going wrong, without being able to reproduce. Does k.theme look okay? Can you upload it? |
I just tried to use LF endings instead of CRLF, but with no success. Attached are both versions of the exported theme. |
The files seem to use the UTF-16 encoding, which is the default on Windows, while pandoc expects all input to use UTF-8. Can you try to convert your files with the methods described in this answer? |
Converting the theme file to UTF-8 does indeed solve the problem. Thank you for your help. Perhaps pandoc could print out a more helpful error message when it is provided with UTF-16 encoded input. |
Maybe we could also support the |
The problem is that we are passing a bytestring to aeson's It does return an error message in this case, but it's so useless that we don't print it: "Error in $: Failed reading: not a valid json value." It would be nice if aeson reported that the input was not properly encoded, but it doesn't work that way. @tarleb it does already work with |
I ran into this issue today. I converted to UTF-8 with Powershell as per the docs but Pandoc stil reports "Could not read the highlighing theme X". Working with Markdown to PDF with Pandoc has been like hiking through 5ft of snow. It's no supposed to be this hard or this bad. pandoc.exe 2.11.4 |
@caressofsteel - can you upload your custom theme so we can test with it? |
I have the same problem too. I run this command:
|
If you upload the file we can take a look. |
These are the two files. The first one created is in utf16, the second is converted to utf8: |
The problem is that your file has a BOM (byte order mark) at the beginning:
The BOM is illegal in JSON (see e.g. https://stackoverflow.com/questions/4990095/json-specification-and-usage-of-bom-charset-encoding). If you remove it, this theme will work. |
Thank you very much, I copied and pasted in notepad++ and then copied again in VSCode, and now it works 💯 |
Suggest documentation to preemptively address user issues like jgm#6704
Suggest documentation to preemptively address user issues like jgm#6704
Suggest documentation to preemptively address user issues like jgm#6704
Suggest documentation to preemptively address user issues like jgm#6704
Suggest documentation to preemptively address user issues like #6704
pandoc exits with error when using a custom theme file, even when it's the unmodified output of --print-highlight
There's a different error message if the file does not exist, so it seems pandoc is unable to correctly parse it.
Perhaps similar to issue #4133?
The text was updated successfully, but these errors were encountered: