Comments (4)
There are many options for this:
-
Just do the 2 actions in 1 function
-
Use multiple files (wait, are you saying that multiple hooks files have a problem?)
-
Use this upcoming feature, though I should double-check whether it actually works for hooks
#3448
Or actually I know what it is - it's about on_page_read_source
specifically. I think this event type is fundamentally broken, actually? The definition is "replace the default mechanism to read the contents of a page's source from the filesystem" - so yeah if you replace the mechanism once and read the original source file, and then replace the mechanism another time and read the original source file, that's exactly what will happen?
I was just looking through your hooks yesterday and saw that your usage would be much simpler served by on_page_markdown
, that's definitely what you should switch to at the moment, and it would not have this problem at all.
from mkdocs.
Oh okay, that makes sense that I was using the wrong plugin type. My bad! Before I close this can you take a look at the PR that I merged to fix this? It works fine but I'm wondering what you think.
from mkdocs.
The actionable thing for me is one of these:
-
Deprecate
on_page_read_source
event type because I think there are better alternatives to it in every case -
Show an error if multiple handlers for it are added (it's the only event type that is incompatible with having multiple handlers)
So it's helpful that you brought this up
from mkdocs.
look at the PR that I merged to fix this
Commented there-
yeah you can revert pypa/hatch#1065 and, in the previous state of the code, change each on_page_read_source
to on_page_markdown
and it's the same except you get the source directly instead of messing with abs_src_path. And, well, it will actually work
from mkdocs.
Related Issues (20)
- Issue with Immediate Rendering of MathJax Formulas HOT 1
- Navigation in generated site is not working correctly, due to bug in index.ts
- Mkdocs online documentation will not update but local documentation will
- Wrong example for `!relative` option HOT 4
- ImportError: cannot import name '_RelativePathExtension' from 'mkdocs.structure.pages'
- Mkdocs plugin loggers don't use `extra` kwarg formatting messages HOT 7
- exclude_docs config set up to include .github/ files still gives 404 HOT 1
- Footnote support
- Directories are always put last in automatic navigation
- dynamic site_dir with configurable prefix HOT 5
- Pass LAZY_OL=False to the OListProcessor through mkdocs config in order to preserve numbering in ordered lists? HOT 1
- Google Analytics 4 tag not appearing in <head>
- Render markdown based on query params
- Limit search results text?
- readthedocs: `prev_next_buttons_location` always at bottom - not working? HOT 2
- Mkdocs uses grayscale rendering for fonts compared to majority of the sites which use subpixel rendering
- Markdown headings in html element HOT 1
- Start the default browser, when starting the `mkdocs serve` command? HOT 6
- With `mkdocs serve` switch to another port if the current port is busy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs.