diff --git a/.github/workflows/changelog-validator.yml b/.github/workflows/changelog-validator.yml index 2dff4708d..bf05b0072 100644 --- a/.github/workflows/changelog-validator.yml +++ b/.github/workflows/changelog-validator.yml @@ -7,14 +7,41 @@ on: - 'docs/changelog.md' jobs: - validate: + validate-unreleased: + # Validates changelog and confirms that an Unreleased entry exists. + # Only run when the `release` label is not set on a PR. + if: ${{ ! contains(github.event.pull_request.labels.*.name, 'release') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Validate Changelog + id: changelog_reader + uses: mindsers/changelog-reader-action@v2 + with: + validation_level: error + path: docs/changelog.md + version: Unreleased + validate-release: + # Validates changelog and confirms an entry exists for version in code. + # Only run when the `release` label is set on a PR. + if: ${{ contains(github.event.pull_request.labels.*.name, 'release') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install Markdown + run: python -m pip install semver . + - name: Get Markdown Version + id: markdown + run: echo "version=$(python -c 'import markdown, semver; print(semver.Version.parse(markdown.__version__, optional_minor_and_patch=True))')" >> $GITHUB_OUTPUT - name: Validate Changelog id: changelog_reader uses: mindsers/changelog-reader-action@v2 with: validation_level: error path: docs/changelog.md + version: ${{ steps.markdown.outputs.version }} diff --git a/docs/changelog.md b/docs/changelog.md index cd427f612..272ca0f54 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,88 +6,88 @@ toc_depth: 2 All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See the [Contributing Guide](contributing.md) for details. +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +See the [Contributing Guide](contributing.md) for details. ## [Unreleased] ### Changed * DRY fix in `abbr` extension by introducing method `create_element` (#1483). -* Clean up test directory some removing some redundant tests and port +* Clean up test directory by removing some redundant tests and port non-redundant cases to the newer test framework. * Improved performance of the raw HTML post-processor (#1510). ### Fixed * Backslash Unescape IDs set via `attr_list` on `toc` (#1493). -* `md_in_html` will process content inside "markdown" blocks a similar way - as they are parsed outside of "markdown" blocks giving a more consistent - expectation to external extensions (#1503). +* Ensure `md_in_html` processes content inside "markdown" blocks as they are + parsed outside of "markdown" blocks to keep things more consistent for + third-party extensions (#1503). * `md_in_html` handle tags within inline code blocks better (#1075). * `md_in_html` fix handling of one-liner block HTML handling (#1074). * Ensure `
` tags
+* CodeHilite now always wraps with `` tags
-Before, the HTML generated by CodeHilite looked like:
-- `foo = 'bar'
` if you **were not** using Pygments.
-- `foo = 'bar'
` if you **were** using Pygments.
+ Before, the HTML generated by CodeHilite looked like:
+ - `foo = 'bar'
` if you **were not** using Pygments.
+ - `foo = 'bar'
` if you **were** using Pygments.
-To make the cases more consistent (and adhere to many Markdown specifications and
-HTML code block markup suggestions), CodeHilite will now always additionally wrap
-code with `` tags. See #862 for more details.
+ To make the cases more consistent (and adhere to many Markdown specifications and
+ HTML code block markup suggestions), CodeHilite will now always additionally wrap
+ code with `` tags. See #862 for more details.
-This change does not alter the Python-Markdown API, but users relying on the old
-markup will find their output now changed.
+ This change does not alter the Python-Markdown API, but users relying on the old
+ markup will find their output now changed.
-Internally, this change relies on the Pygments 2.4, so you must be using at least
-that version to see this effect. Users with earlier Pygments versions will
-continue to see the old behavior.
+ Internally, this change relies on the Pygments 2.4, so you must be using at least
+ that version to see this effect. Users with earlier Pygments versions will
+ continue to see the old behavior.
-#### `markdown.util.etree` deprecated
+* `markdown.util.etree` deprecated
-Previously, Python-Markdown was using either the `xml.etree.cElementTree` module
-or the `xml.etree.ElementTree` module, based on their availability. In modern
-Python versions, the former is a deprecated alias for the latter. Thus, the
-compatibility layer is deprecated and extensions are advised to use
-`xml.etree.ElementTree` directly. Importing `markdown.util.etree` will raise
-a `DeprecationWarning` beginning in version 3.2 and may be removed in a future
-release.
+ Previously, Python-Markdown was using either the `xml.etree.cElementTree` module
+ or the `xml.etree.ElementTree` module, based on their availability. In modern
+ Python versions, the former is a deprecated alias for the latter. Thus, the
+ compatibility layer is deprecated and extensions are advised to use
+ `xml.etree.ElementTree` directly. Importing `markdown.util.etree` will raise
+ a `DeprecationWarning` beginning in version 3.2 and may be removed in a future
+ release.
-Therefore, extension developers are encouraged to replace
-`from markdown.util import etree` with
-`import xml.etree.ElementTree as etree` in their code.
+ Therefore, extension developers are encouraged to replace
+ `from markdown.util import etree` with
+ `import xml.etree.ElementTree as etree` in their code.
### Added
@@ -552,7 +548,7 @@ Therefore, extension developers are encouraged to replace
* Refactor bold and italic logic in order to solve complex nesting issues (#792).
* Always wrap CodeHilite code in `code` tags (#862).
-## [3.1.1] -- 2019-05-20
+## [3.1.1] - 2019-05-20
### Fixed
@@ -561,18 +557,18 @@ Therefore, extension developers are encouraged to replace
* Prefer public `packaging` module to pkg_resources' private copy of
it (#825).
-## [3.1] -- 2019-03-25
+## [3.1.0] - 2019-03-25
### Changed
-#### `markdown.version` and `markdown.version_info` deprecated
+* `markdown.version` and `markdown.version_info` deprecated
-Historically, version numbers were acquired via the attributes
-`markdown.version` and `markdown.version_info`. As of 3.0, a more standardized
-approach is being followed and versions are acquired via the
-`markdown.__version__` and `markdown.__version_info__` attributes. As of 3.1
-the legacy attributes will raise a `DeprecationWarning` if they are accessed. In
-a future release the legacy attributes will be removed.
+ Historically, version numbers were acquired via the attributes
+ `markdown.version` and `markdown.version_info`. As of 3.0, a more standardized
+ approach is being followed and versions are acquired via the
+ `markdown.__version__` and `markdown.__version_info__` attributes. As of 3.1
+ the legacy attributes will raise a `DeprecationWarning` if they are accessed. In
+ a future release the legacy attributes will be removed.
### Added
@@ -601,206 +597,196 @@ a future release the legacy attributes will be removed.
* Problems with newlines in references has been fixed (#742).
* Escaped `#` are now handled in header syntax (#762).
-## [3.0.1] -- 2018-09-28
+## [3.0.1] - 2018-09-28
### Fixed
* Brought back the `version` and `version_info` variables (#709).
* Added support for hexadecimal HTML entities (#712).
-## [3.0] -- 2018-09-21
+## [3.0.0] - 2018-09-21
### Changed
-#### `enable_attributes` keyword deprecated
+* `enable_attributes` keyword deprecated
+
+ The `enable_attributes` keyword is deprecated in version 3.0 and will be
+ ignored. Previously the keyword was `True` by default and enabled an
+ undocumented way to define attributes on document elements. The feature has been
+ removed from version 3.0. As most users did not use the undocumented feature, it
+ should not affect most users. For the few who did use the feature, it can be
+ enabled by using the [Legacy Attributes](extensions/legacy_attrs.md)
+ extension.
+
+* `smart_emphasis` keyword and `smart_strong` extension deprecated
+
+ The `smart_emphasis` keyword is deprecated in version 3.0 and will be ignored.
+ Previously the keyword was `True` by default and caused the parser to ignore
+ middle-word emphasis. Additionally, the optional `smart_strong` extension
+ provided the same behavior for strong emphasis. Both of those features are now
+ part of the default behavior, and the [Legacy
+ Emphasis](extensions/legacy_em.md) extension is available to disable that
+ behavior.
+
+* `output_formats` simplified to `html` and `xhtml`.
+
+ The `output_formats` keyword now only accepts two options: `html` and `xhtml`
+ Note that if `(x)html1`, `(x)html4` or `(x)html5` are passed in, the number is
+ stripped and ignored.
+
+* `safe_mode` and `html_replacement_text` keywords deprecated
+
+ Both `safe_mode` and the associated `html_replacement_text` keywords are
+ deprecated in version 3.0 and will be ignored. The so-called "safe mode" was
+ never actually "safe" which has resulted in many people having a false sense of
+ security when using it. As an alternative, the developers of Python-Markdown
+ recommend that any untrusted content be passed through an HTML sanitizer (like
+ [Bleach](https://bleach.readthedocs.io/)) after being converted to HTML by
+ markdown. In fact, [Bleach
+ Whitelist](https://github.com/yourcelf/bleach-whitelist) provides a curated list
+ of tags, attributes, and styles suitable for filtering user-provided HTML using
+ bleach.
+
+ If your code previously looked like this:
+
+ html = markdown.markdown(text, safe_mode=True)
+
+ Then it is recommended that you change your code to read something like this:
+
+ import bleach
+ from bleach_whitelist import markdown_tags, markdown_attrs
+ html = bleach.clean(markdown.markdown(text), markdown_tags, markdown_attrs)
+
+ If you are not interested in sanitizing untrusted text, but simply desire to
+ escape raw HTML, then that can be accomplished through an extension which
+ removes HTML parsing:
+
+ from markdown.extensions import Extension
+
+ class EscapeHtml(Extension):
+ def extendMarkdown(self, md):
+ md.preprocessors.deregister('html_block')
+ md.inlinePatterns.deregister('html')
+
+ html = markdown.markdown(text, extensions=[EscapeHtml()])
+
+ As the HTML would not be parsed with the above Extension, then the serializer
+ will escape the raw HTML, which is exactly what happened in previous versions
+ with `safe_mode="escape"`.
+
+* Positional arguments deprecated
+
+ Positional arguments on the `markdown.Markdown()` class are deprecated as are
+ all except the `text` argument on the `markdown.markdown()` wrapper function.
+ Using positional arguments will raise an error. Only keyword arguments should be
+ used. For example, if your code previously looked like this:
+
+ html = markdown.markdown(text, [SomeExtension()])
+
+ Then it is recommended that you change it to read something like this:
+
+ html = markdown.markdown(text, extensions=[SomeExtension()])
+
+ !!! Note
+ This change is being made as a result of deprecating `"safe_mode"` as the
+ `safe_mode` argument was one of the positional arguments. When that argument
+ is removed, the two arguments following it will no longer be at the correct
+ position. It is recommended that you always use keywords when they are
+ supported for this reason.
+
+* Extension name behavior has changed
+
+ In previous versions of Python-Markdown, the built-in extensions received
+ special status and did not require the full path to be provided. Additionally,
+ third party extensions whose name started with `"mdx_"` received the same
+ special treatment. This is no longer the case.
+
+ Support has been added for extensions to define an [entry
+ point](extensions/api.md#entry_point). An entry point is a string name which
+ can be used to point to an `Extension` class. The built-in extensions now have
+ entry points which match the old short names. And any third-party extensions
+ which define entry points can now get the same behavior. See the documentation
+ for each specific extension to find the assigned name.
+
+ If an extension does not define an entry point, then the full path to the
+ extension must be used. See the [documentation](reference.md#extensions) for
+ a full explanation of the current behavior.
+
+* Extension configuration as part of extension name deprecated
+
+ The previously documented method of appending the extension configuration
+ options as a string to the extension name is deprecated and will raise an error.
+ The [`extension_configs`](reference.md#extension_configs) keyword should be
+ used instead. See the [documentation](reference.md#extension_configs) for a
+ full explanation of the current behavior.
+
+* HeaderId extension deprecated
+
+ The HeaderId Extension is deprecated and will raise an error if specified. Use
+ the [Table of Contents](extensions/toc.md) Extension instead, which offers
+ most of the features of the HeaderId Extension and more (support for meta data
+ is missing).
-The `enable_attributes` keyword is deprecated in version 3.0 and will be
-ignored. Previously the keyword was `True` by default and enabled an
-undocumented way to define attributes on document elements. The feature has been
-removed from version 3.0. As most users did not use the undocumented feature, it
-should not affect most users. For the few who did use the feature, it can be
-enabled by using the [Legacy Attributes](extensions/legacy_attrs.md)
-extension.
+ Extension authors who have been using the `slugify` and `unique` functions
+ defined in the HeaderId Extension should note that those functions are now
+ defined in the Table of Contents extension and should adjust their import
+ statements accordingly (`from markdown.extensions.toc import slugify, unique`).
-#### `smart_emphasis` keyword and `smart_strong` extension deprecated
-
-The `smart_emphasis` keyword is deprecated in version 3.0 and will be ignored.
-Previously the keyword was `True` by default and caused the parser to ignore
-middle-word emphasis. Additionally, the optional `smart_strong` extension
-provided the same behavior for strong emphasis. Both of those features are now
-part of the default behavior, and the [Legacy
-Emphasis](extensions/legacy_em.md) extension is available to disable that
-behavior.
-
-#### `output_formats` simplified to `html` and `xhtml`.
+* Homegrown `OrderedDict` has been replaced with a purpose-built `Registry`
-The `output_formats` keyword now only accepts two options: `html` and `xhtml`
-Note that if `(x)html1`, `(x)html4` or `(x)html5` are passed in, the number is
-stripped and ignored.
+ All processors and patterns now get "registered" to a
+ [Registry](extensions/api.md#registry). A backwards compatible shim is
+ included so that existing simple extensions should continue to work.
+ A `DeprecationWarning` will be raised for any code which calls the old API.
-#### `safe_mode` and `html_replacement_text` keywords deprecated
-
-Both `safe_mode` and the associated `html_replacement_text` keywords are
-deprecated in version 3.0 and will be ignored. The so-called "safe mode" was
-never actually "safe" which has resulted in many people having a false sense of
-security when using it. As an alternative, the developers of Python-Markdown
-recommend that any untrusted content be passed through an HTML sanitizer (like
-[Bleach](https://bleach.readthedocs.io/)) after being converted to HTML by
-markdown. In fact, [Bleach
-Whitelist](https://github.com/yourcelf/bleach-whitelist) provides a curated list
-of tags, attributes, and styles suitable for filtering user-provided HTML using
-bleach.
-
-If your code previously looked like this:
+* Markdown class instance references.
-```python
-html = markdown.markdown(text, safe_mode=True)
-```
+ Previously, instances of the `Markdown` class were represented as any one of
+ `md`, `md_instance`, or `markdown`. This inconsistency made it difficult when
+ developing extensions, or just maintaining the existing code. Now, all instances
+ are consistently represented as `md`.
-Then it is recommended that you change your code to read something like this:
-
-```python
-import bleach
-from bleach_whitelist import markdown_tags, markdown_attrs
-html = bleach.clean(markdown.markdown(text), markdown_tags, markdown_attrs)
-```
+ The old attributes on class instances still exist, but raise a
+ `DeprecationWarning` when accessed. Also on classes where the instance was
+ optional, the attribute always exists now and is simply `None` if no instance
+ was provided (previously the attribute would not exist).
-If you are not interested in sanitizing untrusted text, but simply desire to
-escape raw HTML, then that can be accomplished through an extension which
-removes HTML parsing:
+* `markdown.util.isBlockLevel` deprecated
-```python
-from markdown.extensions import Extension
-
-class EscapeHtml(Extension):
- def extendMarkdown(self, md):
- md.preprocessors.deregister('html_block')
- md.inlinePatterns.deregister('html')
+ The `markdown.util.isBlockLevel` function is deprecated and will raise a
+ `DeprecationWarning`. Instead, extensions should use the `isBlockLevel` method
+ of the `Markdown` class instance. Additionally, a list of block level elements
+ is defined in the `block_level_elements` attribute of the `Markdown` class which
+ extensions can access to alter the list of elements which are treated as block
+ level elements.
-html = markdown.markdown(text, extensions=[EscapeHtml()])
-```
-
-As the HTML would not be parsed with the above Extension, then the serializer
-will escape the raw HTML, which is exactly what happened in previous versions
-with `safe_mode="escape"`.
-
-#### Positional arguments deprecated
+* `md_globals` keyword deprecated from extension API
-Positional arguments on the `markdown.Markdown()` class are deprecated as are
-all except the `text` argument on the `markdown.markdown()` wrapper function.
-Using positional arguments will raise an error. Only keyword arguments should be
-used. For example, if your code previously looked like this:
-
-```python
-html = markdown.markdown(text, [SomeExtension()])
-```
-
-Then it is recommended that you change it to read something like this:
-
-```python
-html = markdown.markdown(text, extensions=[SomeExtension()])
-```
-
-!!! Note
- This change is being made as a result of deprecating `"safe_mode"` as the
- `safe_mode` argument was one of the positional arguments. When that argument
- is removed, the two arguments following it will no longer be at the correct
- position. It is recommended that you always use keywords when they are
- supported for this reason.
-
-#### Extension name behavior has changed
-
-In previous versions of Python-Markdown, the built-in extensions received
-special status and did not require the full path to be provided. Additionally,
-third party extensions whose name started with `"mdx_"` received the same
-special treatment. This is no longer the case.
-
-Support has been added for extensions to define an [entry
-point](extensions/api.md#entry_point). An entry point is a string name which
-can be used to point to an `Extension` class. The built-in extensions now have
-entry points which match the old short names. And any third-party extensions
-which define entry points can now get the same behavior. See the documentation
-for each specific extension to find the assigned name.
-
-If an extension does not define an entry point, then the full path to the
-extension must be used. See the [documentation](reference.md#extensions) for
-a full explanation of the current behavior.
-
-#### Extension configuration as part of extension name deprecated
-
-The previously documented method of appending the extension configuration
-options as a string to the extension name is deprecated and will raise an error.
-The [`extension_configs`](reference.md#extension_configs) keyword should be
-used instead. See the [documentation](reference.md#extension_configs) for a
-full explanation of the current behavior.
-
-#### HeaderId extension deprecated
-
-The HeaderId Extension is deprecated and will raise an error if specified. Use
-the [Table of Contents](extensions/toc.md) Extension instead, which offers
-most of the features of the HeaderId Extension and more (support for meta data
-is missing).
-
-Extension authors who have been using the `slugify` and `unique` functions
-defined in the HeaderId Extension should note that those functions are now
-defined in the Table of Contents extension and should adjust their import
-statements accordingly (`from markdown.extensions.toc import slugify, unique`).
-
-#### Homegrown `OrderedDict` has been replaced with a purpose-built `Registry`
+ Previously, the `extendMarkdown` method of a `markdown.extensions.Extension`
+ subclasses accepted an `md_globals` keyword, which contained the value returned
+ by Python's `globals()` built-in function. As all of the configuration is now
+ held within the `Markdown` class instance, access to the globals is no longer
+ necessary and any extensions which expect the keyword will raise a
+ `DeprecationWarning`. A future release will raise an error.
-All processors and patterns now get "registered" to a
-[Registry](extensions/api.md#registry). A backwards compatible shim is
-included so that existing simple extensions should continue to work.
-A `DeprecationWarning` will be raised for any code which calls the old API.
+* `markdown.version` and `markdown.version_info` deprecated
-#### Markdown class instance references.
-
-Previously, instances of the `Markdown` class were represented as any one of
-`md`, `md_instance`, or `markdown`. This inconsistency made it difficult when
-developing extensions, or just maintaining the existing code. Now, all instances
-are consistently represented as `md`.
-
-The old attributes on class instances still exist, but raise a
-`DeprecationWarning` when accessed. Also on classes where the instance was
-optional, the attribute always exists now and is simply `None` if no instance
-was provided (previously the attribute would not exist).
+ Historically, version numbers were acquired via the attributes
+ `markdown.version` and `markdown.version_info`. Moving forward, a more
+ standardized approach is being followed and versions are acquired via the
+ `markdown.__version__` and `markdown.__version_info__` attributes. The legacy
+ attributes are still available to allow distinguishing versions between the
+ legacy Markdown 2.0 series and the Markdown 3.0 series, but in the future the
+ legacy attributes will be removed.
-#### `markdown.util.isBlockLevel` deprecated
-
-The `markdown.util.isBlockLevel` function is deprecated and will raise a
-`DeprecationWarning`. Instead, extensions should use the `isBlockLevel` method
-of the `Markdown` class instance. Additionally, a list of block level elements
-is defined in the `block_level_elements` attribute of the `Markdown` class which
-extensions can access to alter the list of elements which are treated as block
-level elements.
-
-#### `md_globals` keyword deprecated from extension API
+* Added new, more flexible `InlineProcessor` class
-Previously, the `extendMarkdown` method of a `markdown.extensions.Extension`
-subclasses accepted an `md_globals` keyword, which contained the value returned
-by Python's `globals()` built-in function. As all of the configuration is now
-held within the `Markdown` class instance, access to the globals is no longer
-necessary and any extensions which expect the keyword will raise a
-`DeprecationWarning`. A future release will raise an error.
-
-#### `markdown.version` and `markdown.version_info` deprecated
-
-Historically, version numbers were acquired via the attributes
-`markdown.version` and `markdown.version_info`. Moving forward, a more
-standardized approach is being followed and versions are acquired via the
-`markdown.__version__` and `markdown.__version_info__` attributes. The legacy
-attributes are still available to allow distinguishing versions between the
-legacy Markdown 2.0 series and the Markdown 3.0 series, but in the future the
-legacy attributes will be removed.
-
-#### Added new, more flexible `InlineProcessor` class
-
-A new `InlineProcessor` class handles inline processing much better and allows
-for more flexibility. The new `InlineProcessor` classes no longer utilize
-unnecessary pretext and post-text captures. New class can accept the buffer that
-is being worked on and manually process the text without regular expressions and
-return new replacement bounds. This helps us to handle links in a better way and
-handle nested brackets and logic that is too much for regular expression.
+ A new `InlineProcessor` class handles inline processing much better and allows
+ for more flexibility. The new `InlineProcessor` classes no longer utilize
+ unnecessary pretext and post-text captures. New class can accept the buffer that
+ is being worked on and manually process the text without regular expressions and
+ return new replacement bounds. This helps us to handle links in a better way and
+ handle nested brackets and logic that is too much for regular expression.
### Added
@@ -825,7 +811,7 @@ handle nested brackets and logic that is too much for regular expression.
* Additional CSS class names can be appended to
[Admonitions](extensions/admonition.md).
-## Previous Releases
+# Previous Releases
For information on prior releases, see their changelogs: