Adding bioschemas to mkdocs
A small markdown extension to add bioschemas to mkdocs. It requires a yaml or json file with bioschemas markup, and adds it to the rendered html.
addbioschemas is a plain Python-Markdown extension, so it also works with Zensical, the static site generator built by the Material for MkDocs team. Zensical reads mkdocs.yml directly and runs Python-Markdown extensions unchanged, so everything below applies to Zensical projects as-is — no separate configuration is needed.
Installation
pip install addbioschemas
To use the plugin simply add addbioschemas to the list of plugins in mkdocs.yml:
markdown_extensions:
- addbioschemas
Usage
Option 1: add the bioschemas file name to the markdown file
Simply add [add-bioschemas file='path/to/yaml/metadata.yaml'] to the markdown file where you want to add the bioschemas. This method supports multiple metadata files.
A markdown snippet of a page where you want to add bioschemas to:
# awesome title
[add-bioschemas file='path/to/yaml/metadata.yaml']
I started with some YAML and turned it into JSON-LD
Important: If you are using mkdocs-material, make sure there is markdown before the insertion of [add-bioschemas]. Otherwise, other plugins will add incorrect tags to the json-LD chunk.
The contents of path/to/yaml/metadata.yaml use the bioschemas properties:
"@context": https://schema.org/
"@type": LearningResource
"@id": https://elixir-europe-training.github.io/ELIXIR-TrP-LessonTemplate-MkDocs/
http://purl.org/dc/terms/conformsTo:
"@type": CreativeWork
"@id": https://bioschemas.org/profiles/TrainingMaterial/1.0-RELEASE
description: Template for ELIXIR lessons
keywords: FAIR, OPEN, Bioinformatics, Teaching
name: ELIXIR Training Lesson template
# lookup at https://spdx.org/licenses/
license: CC-BY-4.0
author:
- "@type": Person
name: Geert van Geest
email: geert.vangeest@sib.swiss
github: GeertvanGeest
orcid: 0000-0002-1561-078X
- "@type": Person
name: Elin Kronander
github: elinkronander
orcid: 0000-0003-0280-6318
addbioschemas also supports the json format.
Option 2: add the bioschemas file name to mkdocs.yml
Specify the path to the yaml file in mkdocs.yml. This method only supports one metadata file.
Add to mkdocs.yml:
markdown_extensions:
- addbioschemas:
metadata: 'path/to/yaml/metadata.yaml'
A markdown snippet of a page where you want to add bioschemas to:
# awesome title
[add-bioschemas]
I started with some YAML and turned it into JSON-LD
Important: If you are using mkdocs-material, make sure there is markdown before the insertion of [add-bioschemas]. Otherwise, other plugins will add incorrect tags to the json-LD chunk.
Using with Zensical
Zensical can read an existing mkdocs.yml file directly, and runs the same Python-Markdown extensions without changes, so both options above work in a Zensical project without modification — just install addbioschemas and keep your mkdocs.yml as is.
If you migrate a project to Zensical's native zensical.toml configuration instead, configure addbioschemas under its markdown_extensions setting the same way you would for any other Python-Markdown extension; see the Zensical documentation for the exact syntax.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file addbioschemas-1.0.3.tar.gz.
File metadata
- Download URL: addbioschemas-1.0.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3d89affcb79bc41b0e3b14f311209d3eaebfa8a74d6c9f95886bea54acb6997
|
|
| MD5 |
ff01f31e9854de224200547eb1d1aee2
|
|
| BLAKE2b-256 |
a50edb979906949fc1d32b0b065ba8f3f23bf8c601b3812856dc4017435d6d88
|
File details
Details for the file addbioschemas-1.0.3-py3-none-any.whl.
File metadata
- Download URL: addbioschemas-1.0.3-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105b3620b31a1124cea0be3f420b269825837e81b7ae92a4fb7871ae47a4ff44
|
|
| MD5 |
b9ce789f29c73650faade5e41543e41c
|
|
| BLAKE2b-256 |
f45a6db6f4b9a6aa677de95235698a9a7f73db804417ec31c327f81f74d82aa3
|