https://github.com/aphp/mkdocs-eds
Various plugins and extensions to customize mkdocs
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Repository
Various plugins and extensions to customize mkdocs
Basic Info
- Host: GitHub
- Owner: aphp
- License: apache-2.0
- Language: CSS
- Default Branch: main
- Size: 103 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
mkdocs-eds
A small collection of MkDocs plugins and Markdown extensions to make technical docs nicer and more interactive:
- Auto‑generate a full API reference from your Python packages
- Make code and headings clickable to their source/reference
- Add simple “cards” layouts in Markdown
- Render interactive Python snippets with Pret
- Add citation support from a BibTeX file
- Fix Material theme font scaling for embedded components
Installation
Add the package to your project (requires Python ≥ 3.9):
```toml
pyproject.toml
[project.optional-dependencies] docs = [ "mkdocs-eds @ git+https://github.com/aphp/mkdocs-eds.git@main#egg=mkdocs-eds ; python_version>='3.9'", ] ```
Or install directly:
bash
pip install "mkdocs-eds @ git+https://github.com/aphp/mkdocs-eds.git@main#egg=mkdocs-eds"
This package vendors patched forks of mkdocs-autorefs and mkdocstrings-python to enable a few behaviors used below.
Quick start (mkdocs.yml)
Below is a compact example showing the main pieces together. See the per‑plugin sections for options and details.
```yaml site_name: Your Site theme: name: material
plugins: - autogenpages: packagedirs: ["yourpackage"] referencesection: Reference - fixfonts - cards - search - autorefs: # Helps disambiguate duplicate anchors; optional but recommended priority: - "*" - reference - clickablecode: # repourl is optional; autodetected from git remote if omitted repourl: https://github.com/you/your-repo - mkdocstringsoptionstemplates - mkdocstrings: enableinventory: true handlers: python: options: docstringstyle: numpy docstringsectionstyle: spacy membersorder: source showsignature: false mergeinitintoclass: true - bibtex: bibtexfile: "docs/references.bib" - pretsnippet_renderer
nav: - Getting Started: index.md - Reference: reference/ ```
Plugins and features
Auto‑generated Reference (auto_gen_pages)
Automatically builds a full reference section from one or more Python package roots and wires it into your navigation. For each module, a Markdown page is created virtually (no files written to disk) with a ::: package.module mkdocstrings directive.
Example:
```markdown
AnnotatedText {: #pret.ui.metanno.AnnotatedText }
::: pret.ui.metanno.AnnotatedText options: headinglevel: 2 showbases: false showsource: false onlyclass_level: true
```
- Options:
package_dirs(list, required): Package roots to scan (e.g.["your_package"]).reference_section(str, defaultReference): Title for the “Reference” section in the nav.exclude_glob(str, defaultassets/fragments/*): Files to omit from the build.reference_template(str): Template used for each generated page.copy_files(mapping): Copy arbitrary files into the virtual docs tree, e.g.{"changelog.md": "changelog.md"}.
- Nav behavior:
- If your
navcontainsReference: reference/, it is replaced with a nested tree matching your package layout. - Each non‑reference section gets a visible “Overview” link pointing to the index of that section.
- If your
Example:
yaml
plugins:
- auto_gen_pages:
package_dirs: ["your_package"]
reference_section: Reference
copy_files:
changelog.md: changelog.md
Clickable Code (clickable_code)
Adds two kinds of links to your pages:
- Code → docs: Turns Python identifiers found inside multi‑line
<code>blocks into links to their mkdocstrings reference pages (resolved viamkdocs‑autorefs). You can restrict linking via a regexpattern(match against full import path). - Headings → source: Appends a
[source]link to object headings (whose IDs look likepackage.module.Object) pointing to the exact line on your repo at the current commit.
It also makes a few quality‑of‑life tweaks:
- Converts absolute links (
href="/...") to relative links based on the current page. - Turns literal component mentions into links by scanning Python entry points:
eds.<component>links if a matchingspacy_factories/edsnlp_factoriesentry point exists.- Registry literals like
'@group': 'name'become links when resolvable.
Options:
yaml
plugins:
- clickable_code:
# Optional; autodetected from `git remote get-url origin` if omitted
repo_url: https://github.com/you/your-repo
# Optional: only link identifiers matching this regex
pattern: ^your_package\.
Note: This plugin replaces the core autorefs plugin instance internally to avoid event ordering issues. Keep autorefs enabled in your plugins list (optionally with the priority setting shown above) so that cross‑references work across your site.
Cards (cards)
Add simple card layouts using a lightweight Markdown block extension and bundled CSS. Start a group of cards with a line that begins with === card and then write normal Markdown; each === card starts a new card in the same group.
Example:
````markdown === card
#### Title
Some description text.
=== card {: href="/guide/" }
#### Get Started →
Clickable card linking to the guide.
````
Options (mapped to the underlying Markdown extension):
yaml
plugins:
- cards:
slugify: null # custom slugify function name (string) or null
combine_header_slug: false
separator: "-"
The plugin auto‑adds the extension and copies cards.css to the site.
Pret Snippet Renderer (pret_snippet_renderer)
Executes Python code blocks and renders their results using Pret then injects the required JS/CSS assets into your pages. This is handy to show live, interactive components alongside the code that produced them.
- Usage in Markdown:
- Execute a code block: add
pythonlanguage (default executes). - Render the result below the block: add the class
render-with-pret. - Make the code collapsible: also add
code--expandable. - Prevent execution: add
no-exec.
- Execute a code block: add
````markdown Some markdown text before.
```python { .render-with-pret .code--expandable } from pret.ui.joy import Button, Typography, Stack
Button("Click me!") ```
Some more markdown text. ````
- Theme requirement: if you override the theme, add
<script pret-head-scripts>in yourmain.htmlfile.
Bibliography (bibtex)
Adds citation support with automatic bibliography generation from a BibTeX file.
- Configure once:
```yaml
plugins:
- bibtex: bibtex_file: docs/references.bib # order: unsorted | occurrence | alphabetical (default: unsorted) ```
- Cite in Markdown using Pandoc‑style citations:
[@key],[@key1, @key2]. - Optionally define ad‑hoc references anywhere in the page:
markdown [@myref]: Author, 2024. Title. Journal. - A “References” section is appended to each page listing cited works.
Mkdocstrings Templates (mkdocstrings_options_templates)
Points mkdocstrings to the custom templates bundled with this package (under assets/templates). These templates:
- Support
docstring_style: numpyand adocstring_section_style: spacythat renders a compact parameter table similar to spaCy’s docs - Include small tweaks for examples, parameters, and source display
Enable by adding the plugin before mkdocstrings and set your handler options as usual (see the Quick start snippet above).
Fix Material Fonts (fix_fonts)
Material for MkDocs sets a base font‑size of 125%. This can cause size mismatches when embedding components that assume a 100% root size. This plugin:
- Prepends an
override.cssthat resets the base size to 100% and adjusts related sizes accordingly - Copies the stylesheet to the site root so it loads early
Tips
- Keep
Reference: reference/in yournav;auto_gen_pageswill expand it to a full tree from yourpackage_dirs. - If you get cross‑reference collisions (same dotted path exists on multiple pages), set
autorefs.priorityas shown to prefer non‑reference pages over the auto‑generated reference. clickable_codefalls back to your git remote forrepo_url. For monorepos or detached builds, set it explicitly.
Owner
- Name: Greater Paris University Hospitals (AP-HP)
- Login: aphp
- Kind: organization
- Location: Paris
- Website: https://www.aphp.fr/
- Repositories: 35
- Profile: https://github.com/aphp
GitHub Events
Total
- Watch event: 1
- Push event: 2
- Pull request event: 1
- Create event: 1
Last Year
- Watch event: 1
- Push event: 2
- Pull request event: 1
- Create event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- YannickJacob (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- astunparse *
- beautifulsoup4 *
- griffe <0.39
- html5lib *
- jedi *
- mkdocs *
- mkdocs-autorefs @ git+https://github.com/percevalw/mkdocs-autorefs.git@main#egg=mkdocs-autorefs
- pybtex ~=0.24.0