@@ -44,16 +44,10 @@ def markmap(self) -> Dict[str, str]:
4444 """
4545 Provides all markmap libraries defined in mkdocs.yml (if any)
4646 """
47- if self ._markmap is None :
48- extra_javascript = self .config .get ('extra_javascript' , [])
47+ if self ._markmap is None :
4948 self ._markmap : Dict [str , str ] = {}
50- for uri in extra_javascript :
51- for name in MARKMAP .keys ():
52- if f'markmap-{ name } ' in uri .lower ():
53- self ._markmap [name ] = uri
54-
5549 for name , module in MARKMAP .items ():
56- if name not in self ._markmap :
50+ if self .config [ f' { name } _version' ] :
5751 self ._markmap [name ] = module .uri .format (self .config [f'{ name } _version' ])
5852
5953 return self ._markmap
@@ -62,15 +56,15 @@ def _load_scripts(self, soup: BeautifulSoup, script_base_url: str, js_path: Path
6256 for script_url in self .markmap .values ():
6357 if script_url .lower ().startswith ("http" ):
6458 try :
65- src : str = script_base_url + download (js_path , script_url )
59+ src : str = script_base_url + download (js_path , script_url , extname = '.js' )
6660 except Exception as e :
6761 log .error (f'unable to download script: { script_url } ' )
6862 src = script_url
6963
7064 else :
7165 log .info (f"static script detected: { script_url } " )
7266 src = script_url
73-
67+
7468 script : Tag = soup .new_tag ('script' , src = src , type = 'text/javascript' )
7569 soup .head .append (script )
7670
@@ -85,7 +79,7 @@ def _add_statics(soup: BeautifulSoup):
8579 tag : Tag = soup .new_tag (tag_name , type = text_type )
8680 with open (path , 'r' ) as fp :
8781 tag .string = fp .read ()
88- getattr (soup , attribute ).append (tag )
82+ getattr (soup , attribute ).append (tag )
8983
9084 def on_config (self , config : Config ) -> Config :
9185 config ['markdown_extensions' ].append ('markmap' )
0 commit comments