Open szcf-weiya opened 3 years ago
the major reason is that the URL will be changed, and I need to migrate the Disqus comments https://www.mkdocs.org/about/release-notes/#version-10-2018-08-03
the error should be caused due to the incompatibility between mkdocs0.17.2 and mkdocs1.0+ as introduced in https://www.mkdocs.org/user-guide/plugins/ the method has the following four parameters, which are exactly the four arguments written in the plugin, https://github.com/zhaoterryy/mkdocs-git-revision-date-plugin/blob/71c6e115bad0ee00987792aca234128f6309e89c/mkdocs_git_revision_date_plugin/plugin.py#L29 but for mkdocs0.17, the documentation shows that the fourth argument name is different, and actually, that is the reported error message,
TypeError: on_page_markdown() got an unexpected keyword argument 'site_navigation'
Then there would be two choices:
the second one would be better in terms of no changes on the URLs as said above.
first of all, fork it
change
def on_page_markdown(self, markdown, page, config, files):
to
def on_page_markdown(self, markdown, page, config, site_navigation):
then install the package via
$ python setup.py install
then run mkdocs serve
, it throws
File "/media/weiya/PSSD/Programs/anaconda3/envs/py367/lib/python3.6/site-packages/mkdocs_git_revision_date_plugin-0.3-py3.6.egg/mkdocs_git_revision_date_plugin/plugin.py", line 42, in on_page_markdown
AttributeError: 'Page' object has no attribute 'file'
In mkdocs1.x, Page
is defined in https://github.com/mkdocs/mkdocs/blob/e1b77ab66e8305b5f0373b4842b50d2618390a96/mkdocs/structure/pages.py#L17
but in mkdocs0.17,
https://github.com/mkdocs/mkdocs/blob/9ef0ff731d4aade0b68b84bfcbcfd2140067f70a/mkdocs/nav.py#L151-L157
no file
attribute
use abs_url
to get the file location, change
revision_date = self.util.get_revision_date_for_file(page.file.abs_src_path)
to
revision_date = self.util.get_revision_date_for_file(page.abs_url.replace("/index.html", ".md"))
since I had set use_directory_urls: false
, then the URLs always end with /index.html
. It throws,
File "/media/weiya/PSSD/Programs/anaconda3/envs/py367/lib/python3.6/site-packages/git/cmd.py", line 828, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git log --date=short --format=%ad -n 1 /Preface/2016-07-20-Preface-to-the-Second-Edition.md
stderr: 'fatal: ambiguous argument '/Preface/2016-07-20-Preface-to-the-Second-Edition.md': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]''
so I need to add the prefix docs
.
Also note that the default /index.md
is directly rendered as /index.md
, then the replacing returns .md
, no such file, then it will throws
cmdline: git log --date=short --format=%ad -n 1 docs.md
stderr: 'fatal: ambiguous argument 'docs.md': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]''
it succeeds!
with the current setting, adding code block in the admonition
results in
after checking the documentation,
The SuperFences extension allows for arbitrary nesting of code and content blocks inside each other, including admonitions, tabs, lists and all other elements.
so try to add it, and finally, it works!
it seems that superfences
failed, either remotely or locally,
the local failure is due to the upgrade of pygments on 2022.08.07 https://github.com/search?q=user%3Aszcf-weiya+pygments&type=code
check the action log https://github.com/szcf-weiya/techNotes/actions/runs/3511568325/jobs/5882462650
revision date for mkdocs
try to add the revision date plugin https://github.com/zhaoterryy/mkdocs-git-revision-date-plugin/tree/master for ESL-CN currently, no
plugins
, if I add the plugin viait throws