Do not parse HTML pages if we know there are no mermaid charts #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #42.
This optimization should greatly benefit large documentations with limited use of this plugin.
It does not run
BeautifulSoup
on every pages produced bymkdocs
and instead checks first for the wordmermaid
textually.This change allowed a 600 pages documentation (only 1 page with charts) to build in 60s instead of 240s, as about 70% of the total computing time was spent in mermaid's
post_page
event.This PR should not have any meaningful consequences on the generated files, except for the fact that pages not processed by mermaid will not be reformatted by
bs4
(white lines, indentation and attributes re-ordering). This is probably not an issue since it was mostly a side-effect and actually means keeping the output format of basemkdocs
.Three possibilities:
mermaid
but no charts: no changes in performance or output, some computing time still "wasted"mermaid
: much faster processing but output format changed