Skip to content

Commit

Permalink
Merge pull request #20 from timvink/patch-1
Browse files Browse the repository at this point in the history
 Ensure compatibility with future MkDocs versions
  • Loading branch information
daizutabi authored Jul 29, 2020
2 parents 657eb51 + a194978 commit 9cede47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mkapi/plugins/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MkapiPlugin(BasePlugin):
)
server = None

def on_config(self, config):
def on_config(self, config, **kwargs):
"""Inserts `src_dirs` to `sys.path`."""
config_dir = os.path.dirname(config["config_file_path"])
for src_dir in self.config["src_dirs"]:
Expand Down Expand Up @@ -75,7 +75,7 @@ def on_config(self, config):

return config

def on_files(self, files, config):
def on_files(self, files, config, **kwargs):
"""Collects plugin CSS ans JavaScript and appends them to `files`."""
root = os.path.join(os.path.dirname(mkapi.__file__), "theme")
docs_dir = config["docs_dir"]
Expand Down Expand Up @@ -108,7 +108,7 @@ def on_files(self, files, config):

return files

def on_page_markdown(self, markdown, page, config, files):
def on_page_markdown(self, markdown, page, config, files, **kwargs):
"""Converts Markdown source to intermidiate version."""
abs_src_path = page.file.abs_src_path
clean_page_title(page)
Expand All @@ -118,15 +118,15 @@ def on_page_markdown(self, markdown, page, config, files):
self.pages[abs_src_path] = page
return page.markdown

def on_page_content(self, html, page, config, files):
def on_page_content(self, html, page, config, files, **kwargs):
"""Merges html and MkApi's node structure."""
if page.title:
page.title = re.sub(r"<.*?>", "", page.title)
abs_src_path = page.file.abs_src_path
page = self.pages[abs_src_path]
return page.content(html)

def on_page_context(self, context, page, config, nav):
def on_page_context(self, context, page, config, nav, **kwargs):
abs_src_path = page.file.abs_src_path
if abs_src_path in self.abs_api_paths:
clear_prefix(page.toc, 2)
Expand All @@ -135,7 +135,7 @@ def on_page_context(self, context, page, config, nav):
clear_prefix(page.toc, level, id)
return context

def on_serve(self, server, config, builder):
def on_serve(self, server, config, builder, **kwargs):
for path in ["theme", "templates"]:
root = os.path.join(os.path.dirname(mkapi.__file__), path)
server.watch(root, builder)
Expand Down

0 comments on commit 9cede47

Please sign in to comment.