Skip to content

Commit

Permalink
refactor: Reset counter in post build event
Browse files Browse the repository at this point in the history
This change helps keeping stable ids
across rebuilds and live-reload.
  • Loading branch information
pawamoy committed Apr 18, 2023
1 parent 729ca8f commit 3bf80de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/markdown_exec/mkdocs_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from markdown_exec import formatter, formatters, validator
from markdown_exec.logger import patch_loggers
from markdown_exec.rendering import MarkdownConverter

if TYPE_CHECKING:
from jinja2 import Environment
Expand Down Expand Up @@ -70,3 +71,6 @@ def on_env(self, env: Environment, *, config: Config, files: Files) -> Environme
write_file(css_content.encode("utf-8"), os.path.join(config["site_dir"], css_filename))
config["extra_css"].insert(0, css_filename)
return env

def on_post_build(self, *, config: Config) -> None: # noqa: ARG002,D102
MarkdownConverter.counter = 0

0 comments on commit 3bf80de

Please sign in to comment.