Skip to content

Commit

Permalink
Feature/directives (#1777)
Browse files Browse the repository at this point in the history
* Add directive prototype

* Add Figure directive, config, and fix lint

* Monkey patch HR rule so that we can get away with `---` configs

* Fix spelling

* Split directives to own files and provide some fixes and enhancements

- Directives should have the intelligence to know that a user
  specified a target of a span tag. If so, it should be treated
  with span logic.
- Refactor so that raw tags are treated as atomic.
- HTML directive should allow using a 'markdown' option to force
  markdown parsing or refuse markdown parsing (atomic). If not specified
  The directive will use normal tag logic to resolve.
- If a directive was actually targeting a span element or atomic was
  being forced, revert fenced code to plain text.
- Add more options to Figure

* `type` is unnecessary parameter in Details and admonition

The first class can serve as the type. Auto add it and auto provide a
title if using a derivative note, etc.

* Some fixes and cleanup

* Handle the shorthand colon options as well.

* Numerous changes

- Require directives to spec parameters and generalize handling
- Use pyyaml to parse inputs
- Rework some of the internal flow

* Each block under a directive calls `on_add` to allow different targets

* Add on_parse event and fix argument spec on admonitions

* Allow directives to declare they take no content or no more content

* Adjust figure to work more like other implementations

We do not currently implement `scale` as that would require us to
depend on pulling in a full image dependency library.

We may add it as an optional dependency. Meaning if you install
Pillow, then it'll work, but if not, it will be rejected.

* Add back on_end event and fix some parameter parsing

* Fix parse blocks

* Adjust type handling

* Simplify some string handling

- Ensure white space is not captured in args
- No need for special YAML override
- No need to strip strings in so many places

* Don't convert string to boolean

* Don't convert from string to ternary

* Add ranged number types and type to test if string value in a list

* Rework syntax

- YAML dividers on config is optional
- A blank line is required between directive header and content
- Directive name does not require `{}` to wrap name in header
- Argument(s) require a separator between directive name and argument(s)

* Remove unnecessary parameter parsers

* Add dedicated `attributes` option for HTML attributes on main element

* Fix lint and logic of type_class

* Add back in fenced code reversal

The idea is that if we code is contained within a an atomic block or
span that fenced code shouldn't have triggered anyways. This puts it
back to the original source to be handled line inline content.

Reverting in the case of span is probably debatable, but from a pure
HTML perspective, it is the right call. We could potential relax this
in the required later, but atomic should always do this.

* Rename to "blocks" and change syntax to `/// name | optional string`

* Handle scenario where there is no blank line before block start

* Remove ability to define non-explicit options

* Add some tests

* Fix block class doc strings

* Clean up dead code

* more tests

* Allow forcing mandatory YAML fences

* backport tab select to new tab format

* Add on register event and allow adding block specific configs

* Add some updated tests

* Admonitions can generate subclasses via a setting

* Add the ability to use colon syntax or slash syntax and

* Add some documentation for blocks

* Update docs/src/markdown/extensions/blocks/index.md

Fix typo

Co-authored-by: Timothée Mazzucotelli <[email protected]>

* Update docs/src/markdown/extensions/blocks/index.md

fix typos

Co-authored-by: Timothée Mazzucotelli <[email protected]>

* Update docs/src/markdown/extensions/blocks/index.md

Fix typos

Co-authored-by: Timothée Mazzucotelli <[email protected]>

* Fix tab related tests

* Allow details to define shortcuts for types like admonitions

* Some initial documentation for block meta-plugins

* More consistent naming

* Fix spelling

* Updates to documentation

* Fix raw block detection

* Adjust tab examples

* Add test for custom details and fix logic

* Add a little bit more details on how meta-plugins are registered

* Set alpha version

* Add links to feedback discussion

* Update changelog

* Add missing discussion link to block page

* Fix tab examples

* Fix example renders

* Config should not use YAML fences, but should instead use line tokens

* Remove `require_yaml_fences` and fix some nesting issues.

* Remove custom HR processors

* Add support for indented YAML config and bump alpha version

* Update documentation and tests

* Fix lint

* Ensure / can be escaped when blocks is registered

* Update docs to reference new discussion

* Document API

* Make indentation the default options syntax and remove other approaches

Tests had to be adjusted and it was found that legacy tabs were not
actually outputting correctly, fix them so that they do operate as
expected.

Update documentation accordingly.

* Remove outdated reference to yaml indentation option

* Simplify argument logic, rename some things, and finish up API docs

* Add definition plugin

* Bump version

* Update changelog

* Update discussion links

* Remove redundant type_string in docs and reorder some entries

* Better phrasing of `on_mardown` return values

* Further clarification of `on_init`

* No plugins loaded by default and allow specifying plugins with strings

* Switch parts of documents over to generic blocks and update Block API

- Document missing config stuff.
- Document tracking data across blocks.
- Switch a number of parts over to generic blocks.
- Add custom generic block tool for collapsible code blocks.

* Fix tests after change that registers no blocks by default

* More doc migrations to new generic blocks

* Finish converting legacy containers over to new generic blocks in docs

* Various attribute changes

- HTML blocks use Emmet style tag and attribute defs
- Blocks no longer define `attributes` option, but instead use `$`
  and take Emmet style attribute defs.
- Admonitions and Details no longer define `type` attribute as it is
  redundant with using `$` to set a class.

* Remove colon syntax

* Update version and changelog

* Add back `type` to Details and Admonition

* Simplify block registration

* Rename `$` option to `attrs` and revert back to dictionary of attributes

* Abstract the way plugins work so they behave like normal md extensions

* Update blocks and add type_any

* Simplify argument API and update tests and docs

* Update discussion link

* Documentation fixes

---------

Co-authored-by: Timothée Mazzucotelli <[email protected]>
  • Loading branch information
facelessuser and pawamoy authored Feb 22, 2023
1 parent cdaafe0 commit 82d73d8
Show file tree
Hide file tree
Showing 70 changed files with 7,808 additions and 3,058 deletions.
14 changes: 14 additions & 0 deletions docs/src/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DOM
Dicts
Donath
ElementTree
Emmet
Emoji
EmojiOne
EmojiOne's
Expand Down Expand Up @@ -62,6 +63,7 @@ Limberg
MERCHANTABILITY
MagicLink
MagicLink's
Malus
Mar
MathJax
Mathjax
Expand All @@ -78,9 +80,12 @@ PHP
PNG
PNGs
Pandoc
Parsers
PathConverter
PathConverter's
PlainHTML
Pomaceous
Postprocessor
ProgressBar
PyMdown
PyPI
Expand All @@ -90,6 +95,7 @@ PyYaml's
Pygments
Pymdownx
Reindent
Rosaceae
SCSS
SVG
SVGs
Expand All @@ -104,6 +110,7 @@ TODO
Tasklist
Toc
Tox
Treeprocessor
Twemoji
Twemoji's
Twitter's
Expand Down Expand Up @@ -147,6 +154,7 @@ facelessuser
formatter
formatter's
formatters
frontmatter
gantt
gemoji
gfm
Expand All @@ -156,6 +164,7 @@ highlighter's
hostnames
html
indepth
indexable
injectable
inline
inlined
Expand Down Expand Up @@ -184,12 +193,15 @@ ned
nl
octocat
online
parser's
parsers
plugin
plugins
plusminus
polyfill
polyfilled
polyfills
positionally
pre
prepend
prepended
Expand All @@ -208,6 +220,7 @@ pypi
pytest
raphael
rc
reStructuredText
rebranded
regex
reindent
Expand All @@ -232,6 +245,7 @@ squidfunk
stylelint
stylesheet
stylesheets
subclasses
sublicense
superfences
syntaxes
Expand Down
7 changes: 7 additions & 0 deletions docs/src/markdown/.snippets/blocksbeta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// warning | Beta Release
Blocks is currently only available in the Pymdown Extensions beta release. It is a work in progress and API and
syntax are subject to change.

Any and all feedback regarding these experimental blocks is appreciated. Let us know what you think so we can improve
and make these a stable feature. Please provide feedback here: https://github.com/facelessuser/pymdown-extensions/discussions/1961.
///
73 changes: 40 additions & 33 deletions docs/src/markdown/.snippets/links.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,66 @@
[_admonition_block]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/admonition.py "Source"
[_arithmatex]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/arithmatex.py "Source"
[_b64]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/b64.py "Source"
[_betterem]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/betterem.py "Source"
[_blocks]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/__init__.py "Source"
[_caret]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/caret.py "Source"
[_critic]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/critic.py "Source"
[_definition_block]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/definition.py "Source"
[_details]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/details.py "Source"
[_details_block]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/details.py "Source"
[_emoji]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/emoji.py "Source"
[_escapeall]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/escapeall.py "Source"
[_extra]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/extra.py "Source"
[_highlight]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/highlight.py "Source"
[_html_block]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/html.py "Source"
[_inlinehilite]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/inlinehilite.py "Source"
[_keys]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/keys.py "Source"
[_magiclink]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/magiclink.py "Source"
[_mark]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/mark.py "Source"
[_pathconverter]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/pathconverter.py "Source"
[_progressbar]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/progressbar.py "Source"
[_saneheaders]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/saneheaders.py "Source"
[_slugs]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/slugs.py "Source"
[_smartsymbols]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/smartsymbols.py "Source"
[_snippets]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/snippets.py "Source"
[_striphtml]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/striphtml.py "Source"
[_superfences]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/superfences.py "Source"
[_tab_block]: https://github.com/facelessuser/pymdown-extensions/blob/feature/directives/pymdownx/blocks/tab.py "Source"
[_tabbed]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tabbed.py "Source"
[_tasklist]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tasklist.py "Source"
[_tilde]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tilde.py "Source"
[abbreviations]: https://python-markdown.github.io/extensions/abbreviations/
[admonition]: https://python-markdown.github.io/extensions/admonition/
[aspell]: http://aspell.net/
[attr-list]: https://python-markdown.github.io/extensions/attr_list/
[bleach]: https://pypi.python.org/pypi/bleach
[codehilite]: https://python-markdown.github.io/extensions/code_hilite/
[coverage]: https://coverage.readthedocs.io
[critic-markup]: http://criticmarkup.com/
[def-list]: https://python-markdown.github.io/extensions/definition_lists/
[emojione]: https://github.com/Ranks/emojione
[emojione-awesome-css]: https://github.com/Ranks/emojione/blob/master/extras/css/emojione-awesome.css
[emojione-index]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/emoji1_db.py
[emojione-sprites-svg]: https://github.com/Ranks/emojione/blob/v2.2.7/assets/sprites/emojione.sprites.svg
[flake8]: https://pypi.python.org/pypi/flake8
[emojione]: https://github.com/Ranks/emojione
[flake8-docstrings]: https://pypi.python.org/pypi/flake8-docstrings
[flake8]: https://pypi.python.org/pypi/flake8
[footnotes]: https://python-markdown.github.io/extensions/footnotes/
[gemoji]: https://github.com/github/gemoji
[gemoji-index]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/gemoji_db.py
[gemoji]: https://github.com/github/gemoji
[github-api-emoji]: https://developer.github.com/v3/emojis/
[github-api-oauth]: https://developer.github.com/v3/oauth/
[highlightjs]: https://highlightjs.org/
[katex]: https://github.com/Khan/KaTeX
[magiclink-icons]: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/scss/extensions/_magiclink.scss
[mathjax]: http://www.mathjax.org/
[mermaid]: https://mermaid-js.github.io/mermaid/#/
[md-in-html]: https://python-markdown.github.io/extensions/md_in_html/
[mermaid-config]: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/markdown/_snippets/uml.txt
[mermaid-loader]: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/js/uml.js
[mermaid-style]: https://github.com/facelessuser/pymdown-extensions/blob/master/docs/src/scss/js/_mermaid.scss
[md-in-html]: https://python-markdown.github.io/extensions/md_in_html/
[mkdocs]: https://github.com/mkdocs/mkdocs
[mkdocs-material]: https://github.com/squidfunk/mkdocs-material
[mermaid]: https://mermaid-js.github.io/mermaid/#/
[mkdocs-config]: https://github.com/facelessuser/pymdown-extensions/blob/master/mkdocs.yml
[mkdocs-material]: https://github.com/squidfunk/mkdocs-material
[mkdocs]: https://github.com/mkdocs/mkdocs
[nested-markdown]: https://python-markdown.github.io/extensions/extra/#nested-markdown-inside-html-blocks
[nl2br]: https://python-markdown.github.io/extensions/nl2br/
[octicons]: https://octicons.github.com/
Expand All @@ -43,31 +75,6 @@
[tables]: https://python-markdown.github.io/extensions/tables/
[toc]: https://python-markdown.github.io/extensions/toc/
[tox]: https://pypi.python.org/pypi/tox
[twemoji]: https://github.com/twitter/twemoji
[twemoji-index]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/twemoji_db.py
[twemoji]: https://github.com/twitter/twemoji
[unicode-norm]: http://unicode.org/reports/tr15/#Norm_Forms
[_b64]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/b64.py "Source"
[_arithmatex]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/arithmatex.py "Source"
[_betterem]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/betterem.py "Source"
[_caret]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/caret.py "Source"
[_critic]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/critic.py "Source"
[_details]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/details.py "Source"
[_emoji]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/emoji.py "Source"
[_escapeall]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/escapeall.py "Source"
[_extra]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/extra.py "Source"
[_highlight]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/highlight.py "Source"
[_inlinehilite]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/inlinehilite.py "Source"
[_keys]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/keys.py "Source"
[_magiclink]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/magiclink.py "Source"
[_mark]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/mark.py "Source"
[_pathconverter]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/pathconverter.py "Source"
[_progressbar]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/progressbar.py "Source"
[_saneheaders]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/saneheaders.py "Source"
[_slugs]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/slugs.py "Source"
[_smartsymbols]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/smartsymbols.py "Source"
[_snippets]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/snippets.py "Source"
[_striphtml]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/striphtml.py "Source"
[_superfences]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/superfences.py "Source"
[_tabbed]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tabbed.py "Source"
[_tasklist]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tasklist.py "Source"
[_tilde]: https://github.com/facelessuser/pymdown-extensions/blob/master/pymdownx/tilde.py "Source"
31 changes: 31 additions & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
# Changelog
## 9.10b1

- **NEW**: HTML General block now accepts Emmet style attribute: `/// html | div.class#id[name=value]`.
- **NEW**: Block attribute specifier is renamed from `attributes` to `attrs`.
- **NEW**: Remove `colon_syntax` option and cement that we are using `///` format moving forward.
- **NEW**: Revise available validators for Block options. Remove unnecessary validators and replace some with new ones.
- **NEW**: Simplify argument API.
- **NEW**: Block extensions can now be registered directly as normal Python Markdown extensions.

## 9.10a3

- **NEW**: General blocks now use an indented option block right after the header. `yaml_indent` option has been
removed.
- **NEW**: Added new "Definition" block that allows the creation of definition lists.
- **NEW**: Simplified argument configuration.
- **NEW**: Some internal cleanup.
- **NEW**: Documented current API.

## 9.10a2

- **NEW**: General blocks no longer use YAML fences for per block options, but instead use a special token to denote the
line is part of the config.
- **NEW**: Add temporary alpha/beta option `yaml_indent` to control whether per-block YAML configs use indentation or a
leading special character: `/` for `///` syntax and `:` for `:::` syntax (`colon_syntax` must be true to use `:::`
syntax).
- **NEW**: Ensure that `/` character can be escaped when registering the `blocks` extension.
- **FIX**: Fix some block nesting issues.

## 9.10a1

- **NEW**: Experimental general purpose blocks.

## 9.9.3

Expand Down
96 changes: 49 additions & 47 deletions docs/src/markdown/about/releases/9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,34 @@ proper. This is because the plugin butchers white space in the wrapper `#!html <
math in a `#!html <pre>` and move on :smile:. This is configurable as an Arithmatex option called `block_tag` and
`inline_tag`. The custom fences and formatters also have a `tag` option where this can be configured.

!!! note "MkDocs Users"
Fear not, this works for MkDocs as well! Using the following syntax can allow you to specify the function with
keyword arguments:

```yaml
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: math
class: arithmatex
format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {kwds: {mode: generic, tag: pre}}
```

While the above is a personal preference as it keeps the arguments on the same line as the function, you can also
specify them in this way which some may find cleaner:

```yaml
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: math
class: arithmatex
format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format
kwds:
mode: generic
tag: pre
```
/// note | MkDocs Users
Fear not, this works for MkDocs as well! Using the following syntax can allow you to specify the function with
keyword arguments:

```yaml
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: math
class: arithmatex
format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format {kwds: {mode: generic, tag: pre}}
```
While the above is a personal preference as it keeps the arguments on the same line as the function, you can also
specify them in this way which some may find cleaner:
```yaml
markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: math
class: arithmatex
format: !!python/object/apply:pymdownx.arithmatex.arithmatex_fenced_format
kwds:
mode: generic
tag: pre
```
///
## One Slugify to Rule Them All
Expand All @@ -114,23 +115,24 @@ Name | Migration
Additionally, you can now set `case="fold"` to use Python's default case folding and set `normalize` to different
Unicode normalization modes (`NFC` is default).

!!! note "MkDocs Users"
Fear not, this works for MkDocs as well! Using the following syntax can allow you to specify the function with
keyword arguments:

```yaml
markdown_extensions:
- markdown.extensions.toc:
slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}
```

While the above is a personal preference as it keeps the arguments on the same line as the function, you can also
specify them in this way which some may find cleaner:

```yaml
markdown_extensions:
- markdown.extensions.toc:
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
```
/// note | MkDocs Users
Fear not, this works for MkDocs as well! Using the following syntax can allow you to specify the function with
keyword arguments:

```yaml
markdown_extensions:
- markdown.extensions.toc:
slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}
```

While the above is a personal preference as it keeps the arguments on the same line as the function, you can also
specify them in this way which some may find cleaner:

```yaml
markdown_extensions:
- markdown.extensions.toc:
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
```
///
Loading

0 comments on commit 82d73d8

Please sign in to comment.