Mkdocs Extension#
The mkdocs extension is mostly derived from the sphinx extension.
This extension requires mkdocs and pymdown-extensions to be
installed. Adding the [mkdocs] extra will help ensure at least minimum tested
versions are installed e.g.:
pip install urljsf[mkdocs]conda install urljsf-with-mkdocs
Configure#
Add urljsf to a project’s mkdocs configuration in mkdocs.yml:
# mkdocs.yml
plugins:
- urljsf
# these are added if missing
# - pymdownx.superfences
# - attr_list
Optionally, provide a partial schema object with defaults that will be
merged with every form definition:
# mkdocs.yml
plugins:
- urljsf:
defaults:
iframe: true
no_bootstrap: true
Write#
Embed forms with the urljsf fenced code block in an .md file:
> As a relative or absolute path:
```urljsf {path=./path/to/urljsf.toml}
```
> As inline `json`, `toml`, or `yaml`:
```urljsf {format=toml}
[forms.url.schema]
title = "pick an xkcd"
description = "this will redirect to `xkcd.com`"
type = "object"
required = ["xkcd"]
properties.xkcd = {type="integer", minimum=1, maximum=2997}
[forms.url.ui_schema.xkcd."ui:options"]
widget = "range"
[templates]
url = "https://xkcd.com/{{ data.url.xkcd }}"
submit_button = "see xkcd #{{ data.url.xkcd }}"
```
Any values provided in mkdocs.yml will be overwritten, and schema,
etc. may be a URL or come from
python.