Closed mkoertgen closed 8 years ago
I'd probably have a hard time replicating this, so I'd appreciate if you could look into it, yes. Thanks! If you need help anywhere, just comment on this issue and/or send me an email. Just submit a pull request if you've got a working fix and I'll take a look at it.
Alternatively,you could provide me with the troublesome mkdocs documentation (if it's something you can share, that is) and/or a minimum example that provokes the problem and I can have a go at it.
I added a quick print to see the values fed into the regex.
It's simple: img_name
is calculated as the absolute file name. On Windows, img_name
then typically contains some \
which need to be handled.
I didn't specify alt
anywhere, so it's always empty.
Anyway, i added re.escape()
for both arguments. Now i'm watching python running for about 15 minutes, consuming 1.5GB and - until now - not writing a single character to output.
It seems that escaping just adds up \
to the regex so the while loop never terminates.
I'l get back to you, ;-)
I ended up replacing then Windows path separator. This works fine for me but adds a little unnecessary extra work on Unix systems, cf.: https://github.com/mkoertgen/mkdocs-pandoc/commit/5b5888788a0835a594d8e285a4504703d557ebc4
The path separator adjustment code looks fine, apart from the inline comment I made regarding the debug statement. I don't mind that little bit of extra code, especially if that's all it takes to port mkdocs-pandoc to Windows. Did you get the expected Pandoc output with that fix in place? If so, and if you remove the debug statement I'm happy to merge that commit.
As for the changes in README.md: I'd prefer to retain the fenced code blocks the way they are. While that syntax is not supported in all markdown dialects, it is in most and it is more resilient against editing errors (tabs vs. spaces can break things with indented blocks).
I'm happy to include the --proxy
thing and anything else I may have missed, though :-)
Ah ok, good point. I was not aware of that. You should see the PR updated with https://github.com/mkoertgen/mkdocs-pandoc/commit/d27393900c8641ecb8150cc54e41efb3e46703f6
Yes, generated .pd looks quite fine. So i think Windows compat. seems good.
One point was that i needed to insert some page breaks here and there to make the output looking good. I didn't fully groke the code but i guess that flattening the pages
from mkdocs.yml
and adding headers might need a preceeding extra line break in some situations, probably here chapterhead.py#L29. This worked for me
head = ['\n' + ('#' * self.headlevel) + ' ' + self.title, '']
Also, when generating a pdf it did not comprise the whole toc. Skipping the head level filter kind of fixed this for me pandoc_converter.py#L137
But this should probably go into another issue. I would be happy to help out there if i can.
Update: This seems more to be a pandoc issue. The output generated by mkdocs2pandoc looks quite good.
Ok, the pull request looks good now, thanks! One last thing: Could you rebase your topic branch down to just one commit so the commit log doesn not get so crowded? Once that's done I'll happily merge it.
Good to hear that Windows compatibility is almost there :-)
As for the extra newlines thing, yeah, that's definitely another bug. Let's create one and look at it in detail over there...
Merged, Thanks!
I'll wait with cutting a new release until the missing linebreaks problem is resolved. Can you open an issue for that?
Sure. I will try to reproduce this in a clean way when opening the issue. Might take some time, though.
No worries. Thanks!
Running the current
mkdocs2pandoc 0.2.4
gives me this error:which refers to images.py#L75.
According to this SO answer the problem might be related with either the image name or the alternative caption containing special characters that might need escaping before feeding into regex.
I am not so much into python but would be willing to work on this issue. Please let me know.