Update dependency mdformat-mkdocs to v4 (#15011)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[mdformat-mkdocs](https://redirect.github.com/kyleking/mdformat-mkdocs)
([changelog](https://redirect.github.com/kyleking/mdformat-mkdocs/releases))
| `==3.1.1` -> `==4.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/mdformat-mkdocs/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/mdformat-mkdocs/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/mdformat-mkdocs/3.1.1/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/mdformat-mkdocs/3.1.1/4.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>kyleking/mdformat-mkdocs (mdformat-mkdocs)</summary>

###
[`v4.0.0`](https://redirect.github.com/KyleKing/mdformat-mkdocs/releases/tag/v4.0.0)

[Compare
Source](https://redirect.github.com/kyleking/mdformat-mkdocs/compare/v3.1.1...v4.0.0)

#### What's Changed

- fix!: add newline after title for consistency with MKDocs style by
[@&#8203;KyleKing](https://redirect.github.com/KyleKing) in
[https://github.com/KyleKing/mdformat-mkdocs/pull/44](https://redirect.github.com/KyleKing/mdformat-mkdocs/pull/44)

**Full Changelog**:
https://github.com/KyleKing/mdformat-mkdocs/compare/v3.1.1...v4.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS41OC4xIiwidXBkYXRlZEluVmVyIjoiMzkuNTguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW50ZXJuYWwiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Kyle King <KyleKing@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2024-12-16 22:48:37 +05:30 committed by GitHub
parent 6a5eff6017
commit 50739f91dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 81 additions and 54 deletions

View file

@ -1,44 +0,0 @@
from __future__ import annotations
from typing import TYPE_CHECKING
import mdformat
if TYPE_CHECKING:
import argparse
from markdown_it import MarkdownIt
from mdformat.renderer import RenderContext, RenderTreeNode
class NoEscapeTextPlugin:
r"""Overrides the default text formatting behavior of mdformat.
By default mdformat will escape any markdown special character found in a
text block, e.g., <. Some of these characters are found in our
documentation, and when escaped (i.e. \<) will be rendered incorrectly by
mkdocs, i.e., the backslash will appear in the render. Because our only
purpose in using mdformat is to manage the line-breaks, it makes sense to
override its text formatting behavior.
"""
def __init__(self: NoEscapeTextPlugin) -> None:
self.POSTPROCESSORS = {"text": NoEscapeTextPlugin.text}
self.RENDERERS = {}
@staticmethod
def add_cli_options(parser: argparse.ArgumentParser) -> None:
pass
@staticmethod
def update_mdit(mdit: MarkdownIt) -> None:
pass
@staticmethod
def text(_text: str, node: RenderTreeNode, _context: RenderContext) -> str:
return node.content
def add_no_escape_text_plugin() -> None:
"""Add NoEscapeTextPlugin to the list of mdformat extensions."""
mdformat.plugins.PARSER_EXTENSIONS["no-escape-text"] = NoEscapeTextPlugin()

View file

@ -14,8 +14,6 @@ from typing import NamedTuple
import mdformat
import yaml
from _mdformat_utils import add_no_escape_text_plugin
class Section(NamedTuple):
"""A section to include in the MkDocs documentation."""
@ -229,12 +227,11 @@ def main() -> None:
f.write(clean_file_content(file_content, title))
add_no_escape_text_plugin()
for rule_doc in Path("docs/rules").glob("*.md"):
# Format rules docs. This has to be completed before adding the meta description
# otherwise the meta description will be formatted in a way that mkdocs does not
# support.
mdformat.file(rule_doc, extensions=["mkdocs", "admon", "no-escape-text"])
mdformat.file(rule_doc, extensions=["mkdocs"])
generate_rule_metadata(rule_doc)