Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
supcik committed Jul 12, 2023
1 parent cf6105f commit ac55723
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
hooks:
- id: isort
name: isort
entry: isort
entry: poetry run isort
language: system
types: [python]
args: ["."]
Expand All @@ -21,7 +21,7 @@ repos:
hooks:
- id: pylint
name: pylint
entry: pylint
entry: poetry run pylint
language: system
types: [python]
args: [
Expand Down
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# mkdocs-jconfig-plugin

This MkDocs plugin allows to process configuration variables using [Jinja](https://jinja.palletsprojects.com/) templates.

## Installation

Install the package with pip:

```bash
pip install mkdocs-jconfig-plugin
```

Activate the plugin in `mkdocs.yml`:

```yaml
plugins:
- search
- calendar
- jconfig
```
## Configuration
The plugin can be configured in the `plugins` section of `mkdocs.yml` as follows:

```yaml
plugins:
- search
- calendar
- jconfig:
items:
- copyright
```

The plugin supports the following configuration options:

| Option | Description |
|---------|-----------------------------------------------------------|
| `items` | The configuration variables to process. Defaults to `[]`. |

## Typical usage

This plugin is useful when you want to automatically adjust the year in the copyright:

```yaml
copyright: copyright {{ cal.today.year }} The Authors
plugins:
- search
- calendar
- jconfig:
items:
- copyright
```

Note that you need to activate the [calendar](https://github.com/supcik/mkdocs-calendar-plugin) plugin for this to work.
88 changes: 57 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "mkdocs-jconfig-plugin"
version = "0.1.0"
description = "An MkDocs plugin to ..."
version = "0.1.1"
description = "An MkDocs plugin to process configuration items with Jinja2"
authors = ["Jacques Supcik <[email protected]>"]
repository = "https://github.com/supcik/mkdocs-jconfig-plugin"
license = "Apache-2"
Expand Down Expand Up @@ -29,6 +29,7 @@ black = "^23.3.0"
pylint = "^2.17.4"
isort = "^5.12.0"
pre-commit = "^3.3.3"
mkdocs-calendar-plugin = "^0.3.0"

[build-system]
requires = ["poetry-core"]
Expand Down
4 changes: 0 additions & 4 deletions test/simple/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# Hello

{{ test }}

Year : {{ year }}
9 changes: 2 additions & 7 deletions test/simple/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
site_name: JConfig Plugin Test
site_description: Test for JConfig Plugin
copyright: copyright {{ year }}
copyright: copyright {{ cal.today.year }} The Authors
docs_dir: docs
theme: readthedocs

nav:
- Main: index.md

extra:
year: 2023
test: we are in {{ year }}

plugins:
- search
- calendar
- jconfig:
items:
- copyright
- extra.test
- macros

0 comments on commit ac55723

Please sign in to comment.