-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
283 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
cache: 'pip' | ||
- name: Install Python dependencies | ||
run: python -m pip install --upgrade hatch | ||
- name: Build and deploy | ||
run: hatch -e doc run mkdocs gh-deploy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Apple | ||
- Banana | ||
- Strawberry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Configuration | ||
|
||
This plugin provides the following configuration options. | ||
|
||
## Data Directory | ||
The `data_dir` option specifies the directory where data files are stored. By default, this is set to `data`. | ||
|
||
```yaml | ||
plugins: | ||
- data: | ||
data_dir: data | ||
``` | ||
!!! tip | ||
It is recommended to configure the `watch` option in the `mkdocs.yml` file | ||
to automatically reload the site when data files are modified. | ||
|
||
```yaml | ||
watch: | ||
- data | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: Home | ||
--- | ||
# MkDocs Data Plugin | ||
|
||
__MkDocs Data Plugin__ is a plugin for [MkDocs](https://www.mkdocs.org/) that allows | ||
externalizing data from your Markdown files into separate files. | ||
|
||
## Overview | ||
When using this plugin, you can define data in YAML or JSON files | ||
in a separate directory and reference it in your Markdown files. | ||
|
||
```txt | ||
root/ | ||
├── docs/ | ||
│ └── ... | ||
├── data/ | ||
│ └── fruits.yml | ||
└── mkdocs.yml | ||
``` | ||
|
||
```yaml title="fruits.yml" | ||
- Apple | ||
- Banana | ||
- Strawberry | ||
``` | ||
Files in this directory can be referenced in your Markdown files using the `data` variable. | ||
|
||
```markdown | ||
{% raw %} | ||
{% for fruit in data.fruits -%} | ||
- {{ fruit }} | ||
{% endfor %} | ||
{% endraw %} | ||
``` | ||
/// html | div.result | ||
{% for fruit in data.fruits -%} | ||
- {{ fruit }} | ||
{% endfor %} | ||
/// | ||
|
||
## Supported Formats | ||
The plugin supports the following file formats: | ||
|
||
- YAML: `.yml`, `.yaml` | ||
- JSON: `.json` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Installation | ||
This plugin can be installed via `pip`: | ||
|
||
```bash | ||
pip install mkdocs-data-plugin | ||
``` | ||
|
||
## Configuration | ||
To use the plugin, add the following lines to your `mkdocs.yml`: | ||
|
||
```yaml | ||
plugins: | ||
- macros | ||
- data | ||
``` | ||
## Requirements | ||
Aside from Python and MkDocs, the plugin has the following dependencies: | ||
- [`mkdocs-macros-plugin`][macros-plugin]: Needed to provide the `data` variable in pages. | ||
|
||
[macros-plugin]: https://mkdocs-macros-plugin.readthedocs.io/en/latest/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
site_name: "MkDocs Data Plugin Documentation" | ||
site_author: "Joan Puigcerver Ibáñez" | ||
site_url: https://joapuiib.github.io/mkdocs-data-plugin/ | ||
repo_name: joapuiib/mkdocs-data-plugin | ||
repo_url: https://github.com/joapuiib/mkdocs-data-plugin | ||
|
||
watch: | ||
- data | ||
|
||
extra: | ||
social: | ||
- icon: fontawesome/brands/github | ||
link: https://github.com/joapuiib | ||
name: joapuiib @ GitHub | ||
|
||
exclude_docs: | | ||
_* | ||
theme: | ||
name: material | ||
icon: | ||
logo: material/file-send-outline | ||
palette: | ||
# Palette toggle for automatic mode | ||
- media: "(prefers-color-scheme)" | ||
toggle: | ||
icon: material/link | ||
|
||
# Palette toggle for light mode | ||
- media: "(prefers-color-scheme: light)" | ||
primary: deep purple | ||
accent: deep purple | ||
scheme: default | ||
toggle: | ||
icon: material/toggle-switch | ||
name: Switch to dark mode | ||
|
||
# Palette toggle for dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
primary: deep purple | ||
accent: deep purple | ||
scheme: slate | ||
toggle: | ||
icon: material/toggle-switch-off | ||
name: Switch to system preference | ||
|
||
features: | ||
- announce.dismiss | ||
- content.code.copy | ||
- content.code.annotate | ||
- content.tabs.link | ||
- content.tooltips | ||
- navigation.top | ||
- navigation.footer | ||
- navigation.indexes | ||
- navigation.instant | ||
- navigation.tabs | ||
- navigation.top | ||
- toc.follow | ||
- search.share | ||
- search.suggest | ||
|
||
plugins: | ||
- search | ||
- alias: | ||
use_anchor_titles: true | ||
- data | ||
- macros | ||
- social: | ||
enabled: !ENV [CI, false] | ||
- tags | ||
- git-revision-date-localized | ||
|
||
markdown_extensions: | ||
- abbr | ||
- admonition | ||
- attr_list | ||
- def_list | ||
- footnotes | ||
- md_in_html | ||
- sane_lists | ||
- pymdownx.arithmatex: | ||
generic: true | ||
- pymdownx.blocks.html | ||
- pymdownx.blocks.caption | ||
- pymdownx.critic | ||
- pymdownx.details | ||
- pymdownx.emoji: | ||
emoji_index: !!python/name:material.extensions.emoji.twemoji | ||
emoji_generator: !!python/name:material.extensions.emoji.to_svg | ||
- pymdownx.fancylists: | ||
inject_class: true | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
line_spans: __span | ||
pygments_lang_class: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.keys | ||
- pymdownx.magiclink | ||
- pymdownx.saneheaders | ||
- pymdownx.snippets | ||
- pymdownx.superfences: | ||
custom_fences: | ||
- name: mermaid | ||
class: mermaid | ||
format: !!python/name:pymdownx.superfences.fence_code_format | ||
- pymdownx.tabbed: | ||
alternate_style: true | ||
- pymdownx.tasklist: | ||
custom_checkbox: true | ||
- toc: | ||
permalink: true | ||
|
||
nav: | ||
- Home: | ||
- index.md | ||
- installation.md | ||
- Configuration: | ||
- configuration/index.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters