Metadata-Version: 2.1
Name: pymdvar
Version: 1.0.2
Summary: Python-Markdown extension for key-value pair conversion
Home-page: https://github.com/luevano/pymdvar
Author: David Luevano Alvarado
Author-email: david@luevano.xyz
License: GPLv3
Keywords: python,extension,plugin,markdown,website
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Communications :: Email :: Filters
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Text Processing :: Markup :: HTML
Classifier: Topic :: Text Processing :: Markup :: Markdown
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS

# pymdvar - Python-Markdown Variable extension

Simple extension meant to be used to convert variables to their corresponding values. Works with environment variables too.

It uses the `${variable}` syntax. For example, given `variable=value`, the following text:

```md
Foo ${variable} bar
```

Becomes:

```html
<p>Foo value bar</p>
```

## Install

`pymdvar` can be installed via `pip`:

```sh
python -m pip install pymdvar
```

## Usage

The basic usage requires a dictionary with the variables to be passed to the `VariableExtension`:

```py
>>> import markdown
>>> from pymdvar import VariableExtension
>>> markdown.markdown('foo *${test}* bar', extensions=[VariableExtension(variables={'test': 'value'})])
'<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.

Only `a-z`, `A-Z`, `_` and `0-9` characters are accepted.

Passing the extension as a string is supported:

```py
>>> import markdown
>>> markdown.markdown('foo *${test}* bar', extensions=['pymdvar'], extension_configs={'pymdvar': {'variables': {'test': 'value'}}})
'<p>foo <em>value</em> bar</p>'
```

