`codebraid` can't handle raw latex
amichuda opened this issue · comments
When writing in markdown, codebraid
throws an error if you write in raw latex:
## My document
This is text
\newpage
This is text on a new page
This is working for me. Which versions of codebraid
and pandoc
are you using? Does this happen with markdown-to-markdown conversion, or other output formats? What's the error message?
This would be for markdown -> latex PDF. This is the command I use:
codebraid pandoc -f markdown+raw_tex -o test.pdf test.md
That's working for me. Do you happen to need --overwrite
?
That's very strange! I'm getting:
Traceback (most recent call last):
File "/usr/bin/codebraid", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.9/site-packages/codebraid/cmdline.py", line 112, in main
args.func(args)
File "/usr/lib/python3.9/site-packages/codebraid/cmdline.py", line 164, in pandoc
converter.code_braid()
File "/usr/lib/python3.9/site-packages/codebraid/converters/base.py", line 1204, in code_braid
self._postprocess_code_chunks()
File "/usr/lib/python3.9/site-packages/codebraid/converters/pandoc.py", line 1246, in _postprocess_code_chunks
thaw_raw_node(node)
File "/usr/lib/python3.9/site-packages/codebraid/converters/pandoc.py", line 897, in _thaw_raw_node
node['c'] = [node['c'][0][2][0][1], node['c'][1]]
IndexError: list index out of range
I don't think it's getting to pandoc yet, so --overwrite
isn't having an effect.
I just checked and I re-installed with the main branch of codebraid
, 0.6.0.dev4. Which version should I be using?
That codebraid
version should be fine...anything 0.6 dev should be good. This actually looks like it might be a change in the Pandoc AST...which Pandoc version are you using?
pandoc 2.14.0.2
Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.10.5.1,
citeproc 0.4.0.1, ipynb 0.1.0.1
User data directory: /home/lordflaron/.pandoc
Copyright (C) 2006-2021 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
It looks like there was a bug in Pandoc 2.14.x before 2.14.0.3 that was breaking things by discarding code block attributes: jgm/pandoc#7397. I was testing Pandoc 2.12 earlier today and just tried 2.14.2 and never had issues in either case.
Even if changing Pandoc versions fixes things for you, please leave this issue open. I should probably modify some of the code that works with the Pandoc AST so that it gives better errors messages in the event of Pandoc bugs or AST modifications.
Okay! Can confirm that upgrading to pandoc == 2.14.2
fixes the issue.