From 5cfd977d39e9f28c92ec1070ecc87fba39781901 Mon Sep 17 00:00:00 2001 From: JCGoran Date: Thu, 11 May 2023 14:16:55 +0200 Subject: [PATCH 1/3] Added parsing of `code-block` ReST directives --- pdoc/docstrings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdoc/docstrings.py b/pdoc/docstrings.py index 3d3196d3..ff0fa95a 100644 --- a/pdoc/docstrings.py +++ b/pdoc/docstrings.py @@ -393,7 +393,9 @@ def _rst_admonition(m: re.Match[str]) -> str: f"{indent(contents, ind)}\n" f"{ind}\n" ) - elif type == "versionadded": + if type == "code-block": + return f"{ind}```{val}\n{contents}\n```\n" + if type == "versionadded": text = f"New in version {val}" elif type == "versionchanged": text = f"Changed in version {val}" @@ -409,7 +411,7 @@ def _rst_admonition(m: re.Match[str]) -> str: return text - admonition = "note|warning|danger|versionadded|versionchanged|deprecated|seealso|math|include" + admonition = "note|warning|danger|versionadded|versionchanged|deprecated|seealso|math|include|code-block" return re.sub( rf""" ^(?P[ ]*)\.\.[ ]+(?P{admonition})::(?P.*) From cd476308e81ccd7da07ea515b750941f09ea249d Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 30 Sep 2023 03:54:33 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c652d12..a3b41a2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ + - Add support for `code-block` ReST directives - If a variable's value meets certain entropy criteria and matches an environment variable value, pdoc will now emit a warning and display the variable's name as a placeholder instead. This heuristic is meant to prevent accidental leakage of environment secrets and can be disabled by setting From 19c5b137f5e265328f25089a226fd83770a8381c Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 30 Sep 2023 01:55:37 +0000 Subject: [PATCH 3/3] [autofix.ci] apply automated fixes --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3b41a2d..f1d1e824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Add support for `code-block` ReST directives + ([#624](https://github.com/mitmproxy/pdoc/pull/624), @JCGoran) - If a variable's value meets certain entropy criteria and matches an environment variable value, pdoc will now emit a warning and display the variable's name as a placeholder instead. This heuristic is meant to prevent accidental leakage of environment secrets and can be disabled by setting