add KaTeX support to docs

This commit is contained in:
Sina Atalay 2023-09-13 19:07:22 +02:00
parent 672325ea56
commit 7ea2710fc4
2 changed files with 39 additions and 6 deletions

11
docs/javascripts/katex.js Normal file
View File

@ -0,0 +1,11 @@
document$.subscribe(({ body }) => {
renderMathInElement(body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
],
})
})

View File

@ -1,8 +1,10 @@
site_name: RenderCV site_name: RenderCV
site_description: A Python application that creates a CV in PDF from a YAML/JSON input file. site_description: A Python application that creates a CV in PDF from a YAML/JSON input file.
site_author: Sina Atalay
copyright: Copyright © 2023 Sina Atalay
site_url: https://sinaatalay.github.io/rendercv/ site_url: https://sinaatalay.github.io/rendercv/
repo_name: sinaatalay/rendercv
repo_url: https://github.com/sinaatalay/rendercv repo_url: https://github.com/sinaatalay/rendercv
repo_name: sinaatalay/rendercv
edit_uri: edit/main/docs/ edit_uri: edit/main/docs/
theme: theme:
@ -22,18 +24,30 @@ theme:
toggle: toggle:
icon: material/lightbulb icon: material/lightbulb
name: "Switch to light mode" name: "Switch to light mode"
font:
text: Roboto
code: Roboto Mono
features: features:
- content.tabs.link - content.code.copy # the copy-to-clipboard buttons for code blocks
- content.code.annotate - content.action.view # view source button for pages
- content.code.copy - navigation.footer # the previous and next buttons in the footer
- navigation.indexes # allow mother pages to have their own index pages
- navigation.tabs # render classical type of navbar at top
- navigation.top # back to top button
- search.highlight # highlight search results after going to a page
- search.suggest # show search suggestions while typing
- toc.follow # if toc sidebar doesn't fit, scroll to the active heading
nav: nav:
- Quick Start: index.md - Quick Start: index.md
- Contact: contact.md - Contact: contact.md
- Code Reference: - Code Reference:
- Code Reference: reference/index.md
- __main__.py: reference/__main__.md - __main__.py: reference/__main__.md
- data_model.py: reference/data_model.md - data_model.py: reference/data_model.md
- tinytex.py: reference/tinytex.md - rendering.py: reference/rendering.md
plugins: plugins:
- search - search
@ -48,4 +62,12 @@ plugins:
docstring_section_style: list docstring_section_style: list
merge_init_into_class: true merge_init_into_class: true
show_docstring_attributes: true show_docstring_attributes: true
docstring_style: google docstring_style: google
extra_javascript:
- javascripts/katex.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js
extra_css:
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css