Skip to content

Commit

Permalink
fix: Extra UT's and some documentation cleanup. (#8)
Browse files Browse the repository at this point in the history
* fix:Corrected version tagging

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix: Updated unit tests to cover a few scenarios.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix: Updated unit tests to cover a few scenarios.

Signed-off-by: Chris Butler <chris@thebutlers.me>

* fix: Ensure free line after header in precommit test file.

Signed-off-by: Chris Butler <chris@thebutlers.me>
  • Loading branch information
butler54 authored Mar 9, 2021
1 parent d3c4d53 commit 5f262ac
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,32 @@
[![codecov.io][cov-badge]][cov-link]
[![PyPI version][pypi-badge]][pypi-link]

An [mdformat](https://github.com/executablebooks/mdformat) plugin for ensuring that yaml frontmatter is respected. As we are unable
to tell the intent of a user if the yaml is incorrectly formatted it will trigger an exception.
An [mdformat](https://github.com/executablebooks/mdformat) plugin for ensuring that yaml `front-matter` is respected.
Many tools (such as [jekyll](https://github.com/jekyll/jekyll)) use yaml front matter for automation purposes.
`mdformat-frontmatter` only supports yaml. For example:

This package was built from the [template](https://github.com/executablebooks/mdformat-plugin) provided by [executable books](https://github.com/executablebooks) and customized (specifically to separate content PR's from the release cycle).
```markdown

---
test: yaml
---
# This looks okay
For some markdown code.
```

Frontmatter can only be at the first line or two of the code.
```markdown
# This is not
---
test: yaml
---
```
Note: that at this stage this plugin is not that sophisticated. The principle objective is to allow properly formed yaml header blocks to pass through.
Incorrectly formed blocks may result in strange behaviour.

## Development

This package dirver [flit](https://flit.readthedocs.io) as the build engine, and [tox](https://tox.readthedocs.io) for test automation.
This package was built from the [template](https://github.com/executablebooks/mdformat-plugin) provided by [executable books](https://github.com/executablebooks) and customized (specifically to separate content PR's from the release cycle).
This package driver [flit](https://flit.readthedocs.io) as the build engine, and [tox](https://tox.readthedocs.io) for test automation.

To install these development dependencies:

Expand Down
2 changes: 1 addition & 1 deletion mdformat_frontmatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

from .plugin import render_token, update_mdit # noqa: F401

__version__ = "0.0.1"
__version__ = "0.1.2"
33 changes: 33 additions & 0 deletions tests/fixtures.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,36 @@ Some *markdown*

* c
.

Test yaml header
.
---
some: yaml
---
# Now some markdown
And some more.
.
---
some: yaml
---
# Now some markdown

And some more.
.

Test yaml reformat
.
---
some: yaml

---
# Now some markdown
And some more.
.
---
some: yaml
---
# Now some markdown

And some more.
.
5 changes: 4 additions & 1 deletion tests/pre-commit-test.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
test: yaml
---
# Test file

add your syntax here
This file

0 comments on commit 5f262ac

Please sign in to comment.