Skip to content

Commit 35e4776

Browse files
authored
Merge pull request #53 from markmap/neatc0der-patch-1
Update plugin.py
2 parents 3717ee8 + acea1c4 commit 35e4776

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

changelog/v2.4.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# v2.4.1
2+
3+
* Support urls with files as well as directories

mkdocs_markmap/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PACKAGE_NAME: str = "mkdocs_markmap"
22
PROJECT_NAME: str = PACKAGE_NAME.replace("_", "-")
3-
PROJECT_VERSION: str = "2.4.0"
3+
PROJECT_VERSION: str = "2.4.1"
44

55
OWNER: str = "neatc0der"
66
ORGANISATION: str = "markmap"

mkdocs_markmap/extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def extendMarkdown(self, md: Markdown) -> None:
9494
md.preprocessors.register(MarkmapPreprocessor(md, self.getConfigs()), "include_markmap", 102)
9595
for extension in md.registeredExtensions:
9696
if extension.__class__.__name__ == "SuperFencesCodeExtension":
97-
log.info(f"superfences detected by markmap")
97+
log.debug(f"superfences detected by markmap")
9898
try:
9999
from pymdownx.superfences import default_validator, fence_code_format, _formatter, _validator
100100
extension.extend_super_fences(

mkdocs_markmap/plugin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ def on_config(self, config: Config) -> Config:
9797

9898
def on_post_page(self, html: str, page: Page, config: Config, **kwargs) -> str:
9999
if not getattr(page, "_found_markmap", False):
100-
log.info(f"no markmap found: {page.file.name}")
100+
log.debug(f"no markmap found: {page.file.name}")
101101
return html
102102

103+
log.info(f"markmap found: {page.file.name}")
103104
soup: BeautifulSoup = BeautifulSoup(html, "html.parser")
104-
script_base_url: str = re.sub(r"[^/]+?/", "../", re.sub(r"/+?", "/", page.url)) + "js/"
105+
script_base_url: str = re.sub(r"/[^/]*$", "/", re.sub(r"[^/]+?/", "../", re.sub(r"/+?", "/", page.url))) + "js/"
105106
js_path: Path = Path(config["site_dir"]) / "js"
106107
self._load_scripts(soup, script_base_url, js_path)
107108
self._add_statics(soup)

0 commit comments

Comments
 (0)