참고소스 수정본

This commit is contained in:
LASTA_DEV01\lasta
2026-05-12 19:40:31 +09:00
parent 0f34a451fc
commit 2e9204243d
8708 changed files with 3259488 additions and 869 deletions

View File

@@ -0,0 +1,26 @@
from typing import Any
import mkdocs.plugins
from pymdownx import highlight # type: ignore
@mkdocs.plugins.event_priority(0)
# pylint: disable=unused-argument
def on_startup(command: str, dirty: bool) -> None: # noqa: ARG001
"""Monkey patch Highlight extension to hide lines in code blocks."""
original = highlight.Highlight.highlight # type: ignore
def patched(self: Any, src: str, *args: Any, **kwargs: Any) -> Any:
lines = src.splitlines(keepends=True)
final_lines = []
remove_lines = False
for line in lines:
if line.strip() == "# <%hide%>":
remove_lines = not remove_lines
elif not remove_lines:
final_lines.append(line)
return original(self, "".join(final_lines), *args, **kwargs)
highlight.Highlight.highlight = patched