gpoore / codebraid

Live code in Pandoc Markdown
BSD 3-Clause "New" or "Revised" License
376 stars 13 forks source link

Code block tab indentation error (Python) #18

Closed joshuahyatt closed 4 years ago

joshuahyatt commented 4 years ago

When running python with tabs instead of spaces for scope, codebraid does not compile the document. This will fail

```{.python .cb.run}
for i in range(5):
    print(i)

While this will run

```{.python .cb.run}
for i in range(5):
    print(i)
gpoore commented 4 years ago

Apparently Pandoc converts all tabs to spaces by default, so when codebraid searches the original file to find the location of the code (this is useful in reporting any errors), it never finds the code. Pandoc has a --preserve-tabs option, so I will probably need to switch to using that for intermediate document transformations. --preserve-tabs is currently supported, but only applies to the final document transformation, not intermediate steps which is what matters here.

gpoore commented 4 years ago

This is fixed now in the dev version on GitHub, and a new version will be on PyPI soon.