Closed thedemons closed 2 years ago
Hey @thedemons ! This is awesome, thanks a lot for your work! Just want to let you know that I might need a few days to examine the PR.
Hey @thedemons ! This is awesome, thanks a lot for your work! Just want to let you know that I might need a few days to examine the PR.
Thanks. I didn't know how to implement it properly so you might want to edit the code a little bit.
Please take a look at the method get_resolver()
in MkdocsRenderer
. It will now return SmartReferenceResolver
object instead of calling MarkdownRenderer.get_resolver()
because the new resolver need to have a reference to the MkdocsRenderer
object in order to find the page url in MkdocsRenderer.pages
I was thinking of changing the code in the base Renderer class itself but i think that's too much changes for the code base.
The new resolver might also works for HugoRenderer
but i haven't tested it yet.
Hi @NiklasRosenstein, any updates?
Hey @thedemons ,
Sorry for the delay here. I've left a few notes, I'm done skimming the code but I'll go in some more depth later today.
Thanks for the review, I realized that my code is ugly, mostly because this was orginaly created for my personal project only.
I will resolve those issues asap.
Just want to give you a heads-up that linking across pages is now natively supported when using Novella as the build backend in Pydoc-Markdown 4.6.0 (currently on develop and not yet released). You can check out the documentation to find more details about Novella here: http://niklasrosenstein.github.io/pydoc-markdown/
The Renderer
plugins from Pydoc-Markdown will be supported for a while longer, but my focus will be shifting towards improving the integration with Novella. I'm still happy to merge this for anyway who is currently using the Pydoc-Markdown MkDocs integration, but in the next major version (which may be a while to go) that will go away.
Cheers,
Just want to give you a heads-up that linking across pages is now natively supported when using Novella as the build backend in Pydoc-Markdown 4.6.0 (currently on develop and not yet released). You can check out the documentation to find more details about Novella here: http://niklasrosenstein.github.io/pydoc-markdown/
The
Renderer
plugins from Pydoc-Markdown will be supported for a while longer, but my focus will be shifting towards improving the integration with Novella. I'm still happy to merge this for anyway who is currently using the Pydoc-Markdown MkDocs integration, but in the next major version (which may be a while to go) that will go away.Cheers,
That's awesome, sorry that I'm too busy right now to work on this PR, I'll close this and maybe will continue work on it on my 4.5 fork.
Thanks for reviewing my code tho
I have implemented the multiple pages cross-reference resolver. Here are the details.
Preview:
What changed:
SmartReferenceResolver
in the module contrib/renderer/smartresolver.pyMkdocsRenderer
is now using the new resolver to solve cross-reference across multiple pages.Features of the new resolver:
from x import *
.New options for MkdocsRenderer:
True
.import typing
to usetyping.List
, then referencing #typing.List is valid, but #List is not.from typing import *
True
.crossref_import
option requires you to give it the exact module and name of the reference.False
.Known issue:
crossref_import
option for some reason keeps recursively looking for built-in modules (liketyping
oros
) in between two modules. This had been solved by checking if the previous searched module is equal to the next module in the queue.Example .yml for setting up the crossref options:
Live preview: