Closed amber-moe closed 3 years ago
I'm having the same issue. Have there been any findings on your side in the meantime?
If it's of any help to anybody: we realized that the build process fails if mkpdfs cannot find a file where an item in the nav configuration is declared. For you @Amber1990Zhang, that means it is possible that mkpdfs is looking for a file for the "Version" entry in your nav section but cannot find one, and that's why you receive the error message. I hope that helps!
@kruzfuz thanks for your reply, I removed version information this time but it's not working either.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/mkdocs", line 10, in <module>
sys.exit(cli())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/__main__.py", line 163, in build_command
), dirty=not clean)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/commands/build.py", line 298, in build
config['plugins'].run_event('post_build', config)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/plugins.py", line 94, in run_event
result = method(item, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkpdfs_mkdocs/mkpdfs.py", line 64, in on_post_build
self.generator.write()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkpdfs_mkdocs/generator.py", line 53, in write
self.gen_articles()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkpdfs_mkdocs/generator.py", line 168, in gen_articles
self.add_tocs()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkpdfs_mkdocs/generator.py", line 154, in add_tocs
self._gen_toc_section(n)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkpdfs_mkdocs/generator.py", line 186, in _gen_toc_section
stoc = self._gen_toc_for_section(p.file.url, p)
AttributeError: 'Section' object has no attribute 'file'
Hello @kruzfuz and @Amber1990Zhang,
Currently I'm quite busy at work and will look into this issue as soon as possible.
KR, Gerry N
I think the plugin has a problem with mkdocs>=1.1.
I am using mkdocs < 1.1 without a problem.
I'm having the same issue. Did a quick debugging session and found out that the break occurs if the page is given in the mkdocs nav configuration is a URL. Are links supported in the nav?
I'm having the same issue. Did a quick debugging session and found out that the break occurs if the page is given in the mkdocs nav configuration is a URL. Are links supported in the nav?
I opened a PR ( #26 ) which excludes external links. I think this is the best solution for now as i am not sure how to represent external links in the generated pdf.
This should be fixed in the upcoming version. Probably fixed by #8
Some errors happened when I run
mkdocs serve
. The errors as follow:This is my
yaml
file:Please help, thanks.