summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-02-17 02:08:04 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-02-17 02:08:04 -0600
commit3cf528e4b82466e2680c86985e1a80993548e56c (patch)
treef7c0df1ccb9441d80f4195b4589b6dbdc18af15e
parent01ebe668f455384c5cd645c02312c83962a1685d (diff)
add notes to readmeHEADv1.0.3main
-rw-r--r--ChangeLog5
-rw-r--r--README.md25
2 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b976c2d..41df313 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
CHANGES
=======
+v1.0.2
+------
+
+* another version bump..
+
v1.0.1
------
diff --git a/README.md b/README.md
index dcc978b..56b18f0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# pymdvar - Python-Markdown Variable extension
-Simple extension meant to be used to convert variables to their corresponding values. Works with environment variables too.
+Simple extension meant to be used to convert variables to their corresponding values. Works with environment variables too. This is really just built to be used with my other project [pyssg](https://github.com/luevano/pyssg), as I need it there but I figured it could be released as an extension.
It uses the `${variable}` syntax. For example, given `variable=value`, the following text:
@@ -24,7 +24,7 @@ python -m pip install pymdvar
## Usage
-The basic usage requires a dictionary with the variables to be passed to the `VariableExtension`:
+The basic usage requires a dictionary with the variables to be passed to the `VariableExtension` options:
```py
>>> import markdown
@@ -33,9 +33,9 @@ The basic usage requires a dictionary with the variables to be passed to the `Va
'<p>foo <em>value</em> bar</p>'
```
-if `enable_env=True` is passed, then it will read environment variables, too. Variables in `variables` take preference.
+if `enable_env=True` option is set, then it will read environment variables, too. Variables in `variables` take preference.
-Only `a-z`, `A-Z`, `_` and `0-9` characters are accepted.
+Syntax for the variables should only include the characters: `a-z`, `A-Z`, `_` and `0-9`; this limitation is set like this by personal preference, as the "variable" could be any string, could even include spaces and special chars. Variables not found are just replaced by an empty string.
Passing the extension as a string is supported:
@@ -43,4 +43,19 @@ Passing the extension as a string is supported:
>>> import markdown
>>> markdown.markdown('foo *${test}* bar', extensions=['pymdvar'], extension_configs={'pymdvar': {'variables': {'test': 'value'}}})
'<p>foo <em>value</em> bar</p>'
-``` \ No newline at end of file
+```
+
+## Options
+
+Only supported options:
+
+- `variables` (default `dict()`):
+
+ Dictionary containing key-value pairs for variable-values. Example
+
+ ```py
+ variables={'test': 'value', 'key': 'value'}
+ ```
+- `enable_env` (default `False`):
+
+ Enables environment variable reading.