danodic-dev / mkdocs-backlinks Goto Github PK
View Code? Open in Web Editor NEWA plugin for adding backlinks to mkdocs.
License: MIT License
A plugin for adding backlinks to mkdocs.
License: MIT License
Hi, and congratulations for the plugin!
I was wondering how challenging it is to add an interactive graph of backlinks, as in Obsidian Publish:
We have implemented the backlinks on our site https://ecaguide.org, where you can find the backlinks underneath the TOC in the right sidebar. A good place to test them is in the library section, where we have samples that users can download. Those samples have a "Used Plugins" section, and when going to one of those plugins, there you can see the backlinks to the library pages, that actually link to those plugins.
Now, other sections of the guide are also linking to e.g. plugin, but the list of backlinks is just a list of links. We would love to indicate from which section in the guide the backlink is coming from. Is something like that possible?
Backlinks are not created when the target link is changed when use_directory_urls
is True.
The situation is roughly as follows:
Take for example target file test_file.md
.
files_dict
will get the key test_file
. However in the on_page_content
, the destination_link
will be test-file
(note the hyphen).
The solution is to rebuild the lookup table files_dict
again after the links are changed.
Hello there!
I really like this plugin. It helps me visualizing relations inbetween documents.
I work with folders to have an internal structure. The issue I'm facing now is that files that are not in the '/doc' (e.g. root folder) don't seem to be included in the build step of this plugin.
For example if I have files strucutred like this:
File1 does get the backlinks but file 2 does not.
Am I using it wrong? Do I have to tweek some settings?
Greetings
Daniel
Hello,
i am publishing a site in github pages, so the url will be something like : https://avados.github.io/MY_REPO
so, in my mkdocs.yml file i have :
site_url: https://avados.github.io/MY_REPO
but the generated backlinks do not use site_url, so the generated links are : https://avados.github.io/
for example, instead of having a backlink : https://avados.github.io/MY_REPO/tests it will create a backlink https://avados.github.io/tests leading to a 404.
Am i doing something wrong? i am using the snippet you are providing as exemple.
It is quite easy to reproduce locally, just add a site_url as stated above.
Thanks.
This is a great plugin, thank you so much. My only issue is that I get hundreds of warnings while the site is being built:
mkdocs | INFO - GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
mkdocs |
mkdocs | The code that caused this warning is on line 32 of the file /usr/lib/python3.11/site-packages/backlinks_plugin/plugin.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.
mkdocs |
mkdocs | File "/usr/lib/python3.11/site-packages/backlinks_plugin/plugin.py", line 32, in links
mkdocs | links = BeautifulSoup(self.html).find_all('a')
mkdocs | File "/usr/lib/python3.11/site-packages/bs4/__init__.py", line 299, in __init__
mkdocs | warnings.warn(
It looks to me, that changing line 32 from links = BeautifulSoup(self.html).find_all('a')
to links = BeautifulSoup(self.html, feature='lxml').find_all('a')
would avoid those warnings. Could that be added? Or does it have to be made configurable? Although, it's not now either.
你好,我这版使用的是python3.8,你的插件是python3.9以上的版本要求,能支持低版本python呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.