Skip to content

Commit 31ca9b5

Browse files
committed
Update some API related descriptions, update changelog, and bump version
1 parent 0101816 commit 31ca9b5

File tree

3 files changed

+22
-74
lines changed

3 files changed

+22
-74
lines changed

docs/src/markdown/about/changelog.md

+2-54
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
# Changelog
22

3-
## 9.10b5
4-
5-
- **NEW**: Blocks: Add `type_multi` and `type_none` validators.
6-
- **NEW**: Blocks: Rename on_parse to `on_validate` and pass in parent element as context for validation.
7-
- **NEW**: Blocks: When a block uses `raw` mode, allow content to be indented to avoid conflicts with HTML parser. `raw`
8-
blocks _should_ be indented and are now documented as such. The results will be dedented up to Python Markdown's tab
9-
length, so intentional indentation is still possible. `raw` blocks with no indentation will still work, but may have
10-
conflicts with other extensions.
11-
- **FIX**: Blocks: Commenting out all YAML options will not cause a block to invalidate.
12-
13-
## 9.10b4
14-
15-
- **NEW**: Blocks: Add `on_inline_end` event.
16-
17-
## 9.10b3
18-
19-
- **NEW**: Blocks: Ensure inline mode is handled properly.
20-
- **NEW**: Blocks: When using raw mode, ensure HTML stashed content is extracted.
21-
- **NEW**: HTML: The Blocks HTML extension should use `inline` specifier instead of `span`.
22-
23-
## 9.10b2
3+
## 9.10
244

255
- **NEW**: Blocks: Add new experimental general purpose blocks that provide a framework for creating fenced block
266
containers for specialized parsing. A number of extensions utilizing general purpose blocks are included and are meant
27-
to be an alternative to (and maybe one day replace): Admonitions, Details, Definition Lists, and Tabbed. Also adds a
7+
to be an alternative to (and maybe one day replace): Admonitions, Details, Definition Lists, and Tabbed. Also adds a
288
new HTML plugin for quick wrapping of content with arbitrary HTML elements.
299
- **NEW**: Highlight: When enabling line spans and/or line anchors, if a code block has an ID associated with it, line
3010
ids will be generated using that code ID instead of the code block count.
@@ -35,38 +15,6 @@
3515
- **NEW**: MagicLink: Update GitLab links to match recent changes and to be more correct.
3616
- **NEW**: MagicLink: Relax required hash length when performing link shortening.
3717

38-
## 9.10b1
39-
40-
- **NEW**: HTML General block now accepts Emmet style attribute: `/// html | div.class#id[name=value]`.
41-
- **NEW**: Block attribute specifier is renamed from `attributes` to `attrs`.
42-
- **NEW**: Remove `colon_syntax` option and cement that we are using `///` format moving forward.
43-
- **NEW**: Revise available validators for Block options. Remove unnecessary validators and replace some with new ones.
44-
- **NEW**: Simplify argument API.
45-
- **NEW**: Block extensions can now be registered directly as normal Python Markdown extensions.
46-
47-
## 9.10a3
48-
49-
- **NEW**: General blocks now use an indented option block right after the header. `yaml_indent` option has been
50-
removed.
51-
- **NEW**: Added new "Definition" block that allows the creation of definition lists.
52-
- **NEW**: Simplified argument configuration.
53-
- **NEW**: Some internal cleanup.
54-
- **NEW**: Documented current API.
55-
56-
## 9.10a2
57-
58-
- **NEW**: General blocks no longer use YAML fences for per block options, but instead use a special token to denote the
59-
line is part of the config.
60-
- **NEW**: Add temporary alpha/beta option `yaml_indent` to control whether per-block YAML configs use indentation or a
61-
leading special character: `/` for `///` syntax and `:` for `:::` syntax (`colon_syntax` must be true to use `:::`
62-
syntax).
63-
- **NEW**: Ensure that `/` character can be escaped when registering the `blocks` extension.
64-
- **FIX**: Fix some block nesting issues.
65-
66-
## 9.10a1
67-
68-
- **NEW**: Experimental general purpose blocks.
69-
7018
## 9.9.3
7119

7220
- **FIX**: Highlight: Remove extraneous new lines from end of indented code blocks when using

docs/src/markdown/extensions/blocks/api.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -273,32 +273,32 @@ def on_markdown(self) -> str:
273273
```
274274

275275
The `on_markdown` event is used to declare how the content of the block should be handled by the Markdown parser. A
276-
string with one of the following values _must_ be returned. All content is stored under the [etree][etree] element
277-
returned via the [`on_add` event](#on_add-event), regardless of what mode is returned.
276+
string with one of the following values _must_ be returned. All content is treated as HTML content and is stored under
277+
the [etree][etree] element returned via the [`on_add` event](#on_add-event).
278+
279+
Only during the [`on_end` event](#on_end-event) will all the content be fully accumulated and processed by relevant
280+
block processors, and only during the [`on_inline_end` event](#on_inline_end-event) will both block and inline
281+
processing be completed.
278282

279283
Result\ Value | Description
280284
------------- | -----------
281285
`block` | Parsed block content will be handled by the Markdown parser as content under a block element.
282286
`inline` | Parsed block content will be handled by the Markdown parser as content under an inline element.
283-
`raw` | Parsed block content will be preserved as is. No additional Markdown parsing will be applied.
287+
`raw` | Parsed block content will be preserved as is. No additional Markdown parsing will be applied. Content is expected to be indented and should be documented as such.
284288
`auto` | Depending on whether the wrapping parent is a block element, inline element, or something like a code element, Blocks will choose the best approach for the content. Decision is made based on the element returned by the [`on_add` event](#on_add-event).
285289

286-
Only during the [`on_end` event](#on_end-event) will all the content be fully accumulated and processed by relevant
287-
block processors, and only during the [`on_inline_end` event](#on_inline_end-event) will both block and inline
288-
processing be completed.
289-
290-
When using `raw` mode, all text will be accumulated and fully available during the [`on_end` event](#on_end-event).
291-
Content is accessible under the element returned by the [`on_add` event](#on_add-event) and can be accessed via
292-
`element.text`. Text content is stored as a Python Markdown [`AtomicString`][atomic]. If desired, the content can be
293-
stored in the [HTML stash][stash] during the [`on_add` event](#on_add-event)to ensure it makes it through any and all
294-
Treeprocessors after inline handling. Additionally, when storing in the stash, the developer can HTML escape the content
295-
to have the text present as literal or store without HTML escaping to present as an altered HTML content.
296-
297-
A `raw` block expects the content to be an indented code block as this is necessary to avoid some Python Markdown's
298-
internal HTML parser. Content will not have the extra indentation in the final output.
299-
300-
It should be noted that `raw` mode cannot prevent transformations that are applied during Python Markdown's preprocessor
301-
steps. Blocks will attempt to revert any placeholders within the content that are currently found in the HTML stash.
290+
When using `raw` mode, all text will be accumulated under the specified element as an [`AtomicString`][atomic]. If
291+
nothing is done with the content during the [`on_end` event](#on_end-event), all the content will be HTML escaped by the
292+
Python Markdown parser. If desired, the content can be placed into the Python Markdown [HTML stash][stash] which will
293+
protect it from any other rouge Treeprocessors. Keep in mind, if the content is stashed HTML escaping will not be
294+
applied automatically, so HTML escape if it is required.
295+
296+
/// warning | Indent Raw Content
297+
Because Python Markdown implements HTML processing as a preprocessor, content for a `raw` block must be indented 4
298+
spaces to avoid the HTML processing step. The content will not be indented when it reaches the [`on_end` event](#on_end-event).
299+
Failure to indent will still allow the code to be processed, but it may not process as expected. An extension that uses
300+
`raw` should make clear that this is a requirement to avoid unexpected results.
301+
///
302302

303303
## `on_end` Event
304304

pymdownx/__meta__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ def parse_version(ver, pre=False):
185185
return Version(major, minor, micro, release, pre, post, dev)
186186

187187

188-
__version_info__ = Version(9, 10, 0, "beta", 5)
188+
__version_info__ = Version(9, 10, 0, "final")
189189
__version__ = __version_info__._get_canonical()

0 commit comments

Comments
 (0)