Skip to content

Commit 6830087

Browse files
authored
Merge pull request #2 from janaz:mkdocs-1.1
Support mkdocs v1.1
2 parents c5f2ed1 + f9174a0 commit 6830087

File tree

9 files changed

+492
-202
lines changed

9 files changed

+492
-202
lines changed

Pipfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ verify_ssl = true
66
[dev-packages]
77
pipenv-setup = "*"
88
pylint = "*"
9+
black = "*"
910

1011
[packages]
1112
mkdocs = "*"
1213

1314
[requires]
14-
python_version = "3.7"
15+
python_version = "3.8"
16+
17+
[pipenv]
18+
allow_prereleases = true

Pipfile.lock

Lines changed: 227 additions & 192 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ plugins:
1515
- search
1616
- user-defined-values:
1717
keywords:
18-
- DOC_AS_CODE_PATH
19-
- DOC_AS_CODE_VERSION
18+
YOUR_AWS_REGION:
19+
placeholder: e.g. ap-southeast-2
20+
YOUR_AWS_ACCOUNT_ID:
21+
placeholder: e.g. 12355224536
2022
```
2123
2224
> **Note:** If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set, but now you have to enable it explicitly.
@@ -25,13 +27,20 @@ More information about plugins in the [MkDocs documentation][mkdocs-plugins].
2527

2628
## Config
2729

28-
* `keywords` - This is a list of keywords which you want to allow a user to modify.
29-
* `input-placeholder` - This is a placeholder where you want the plugin to generate the form for user to provide dynamic values for each keyword. Default value is `{{{user-defined-values}}}`.
30+
- `keywords` - This is a list of keywords which you want to allow a user to modify.
31+
- `input-placeholder` - This is a placeholder where you want the plugin to generate the form for user to provide dynamic values for each keyword. Default value is `{{{user-defined-values}}}`.
3032

3133
## Usage
3234

33-
* Provide a list of `keywords` you want a user to provide dynamically.
34-
* Place `{{{user-defined-values}}}` in your page or template where you want to generate the form for user to provide dynamic values.
35+
- Provide a list of `keywords` you want a user to provide dynamically.
36+
- Place `{{{user-defined-values}}}` in your page or template where you want to generate the form for user to provide dynamic values.
37+
38+
## Demo/Test
39+
40+
```bash
41+
cd demo
42+
pipenv run mkdocs serve
43+
```
3544

3645
## See Also
3746

@@ -41,4 +50,4 @@ More information about blocks [here][mkdocs-block].
4150

4251
[mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
4352
[mkdocs-template]: https://www.mkdocs.org/user-guide/custom-themes/#template-variables
44-
[mkdocs-block]: https://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks
53+
[mkdocs-block]: https://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks

demo/Pipfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
8+
[packages]
9+
mkdocs-user-defined-values = {editable = true,path = ".."}
10+
11+
[requires]
12+
python_version = "3.8"

demo/Pipfile.lock

Lines changed: 197 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/docs/page_with_plugin.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Page with Plugin
3+
---
4+
5+
# Page with Plugin
6+
7+
{{{user-defined-values}}}
8+
9+
### List ec2 instances for a region
10+
11+
```
12+
aws ec2 describe-instances --output table --region YOUR_AWS_REGION
13+
```

demo/docs/page_without_plugin.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Page without Plugin
3+
---
4+
5+
# Page without Plugin
6+
7+
### List ec2 instances for a region
8+
9+
```
10+
aws ec2 describe-instances --output table --region YOUR_AWS_REGION
11+
```

demo/mkdocs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
site_name: "Demo Test"
2+
use_directory_urls: false
3+
4+
plugins:
5+
- search
6+
- user-defined-values:
7+
keywords:
8+
YOUR_AWS_REGION:
9+
placeholder: e.g. ap-southeast-2

plugin/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class UserDefinedValues(BasePlugin):
66

77
config_scheme = (
88
('keywords', config_options.Type(dict)),
9-
('input-placeholder', config_options.Type(mkdocs_utils.string_types, default='{{{user-defined-values}}}'))
9+
('input-placeholder', config_options.Type(str, default='{{{user-defined-values}}}'))
1010
)
1111

1212
def on_config(self, config, **kwards):
@@ -74,4 +74,4 @@ def on_post_page(self, output_content, page, config):
7474

7575
output_content = output_content.replace(self.config['input-placeholder'], input_boxes)
7676

77-
return output_content
77+
return output_content

0 commit comments

Comments
 (0)