Skip to content
Snippets Groups Projects
Commit c7d163de authored by Teemu Autto's avatar Teemu Autto
Browse files

docs(mkdocs): Added magiclink and necessary macros to generate gitlab links.

Uses hacky approach to monkeypatch magiclink to support hosted gitlab instances.
parent 8506ece4
No related branches found
No related tags found
No related merge requests found
Pipeline #13876 passed
"""
Hack to get the hosted gitlab magiclink extension to work with mkdocs.
See: https://github.com/facelessuser/pymdown-extensions/issues/933
"""
import pymdownx.magiclink
base_url = "https://gitlab.jyu.fi"
pymdownx.magiclink.PROVIDER_INFO["gitlab"].update({
"url": base_url,
"issue": "%s/{}/{}/issues/{}" % base_url,
"pull": "%s/{}/{}/merge_requests/{}" % base_url,
"commit": "%s/{}/{}/commit/{}" % base_url,
"compare": "%s/{}/{}/compare/{}...{}" % base_url,
})
def define_env(env):
pass
...@@ -51,12 +51,22 @@ markdown_extensions: ...@@ -51,12 +51,22 @@ markdown_extensions:
- pymdownx.emoji: - pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.magiclink:
user: startuplab/courses/tjts5901-continuous-software-engineering
repo: TJTS5901-K23_template
provider: gitlab
repo_url_shortener: true
repo_url_shorthand: true
plugins: plugins:
- offline - offline
- search - search
- git-revision-date-localized: - git-revision-date-localized:
type: date type: date
fallback_to_build_date: true fallback_to_build_date: true
- macros:
module_name: macros
extra: extra:
social: social:
......
...@@ -34,6 +34,7 @@ docs = [ ...@@ -34,6 +34,7 @@ docs = [
"mkdocs", "mkdocs",
"mkdocs-material", "mkdocs-material",
"mkdocs-git-revision-date-localized-plugin", "mkdocs-git-revision-date-localized-plugin",
"mkdocs-macros-plugin",
] ]
[build-system] [build-system]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment