Merge pull request 'Fix(markdown): escape sequences for pipe characters in table cells' (#71) from fix/markdown-table-cells-pipe into main
Generate API reference / generate (push) Successful in 22s

Reviewed-on: #71
This commit was merged in pull request #71.
This commit is contained in:
jakob.scheid authored and Gitea committed 2026-10-21 12:33:17 +02:00
commit 39d3b0ace4
5 files changed
+85 -11

No files matched your search

+6
View File
@@ -1,5 +1,11 @@
# Changelog
## [Unreleased]
### Fixed
- Escape sequences for pipe characters in values of Markdown table cells
## [0.2.2] - 2026-10-14
### Fixed
+6 -4
View File
@@ -263,11 +263,13 @@ def _markdown_table(
'| '
+ ' | '.join(
[
str(col if col is not None else missing_value).replace(
'\n', ' '
)
str(col if col is not None else missing_value)
.replace('\n', ' ')
.replace('|', '\\|')
if one_line_values
else str(col if col is not None else missing_value)
else str(
col if col is not None else missing_value
).replace('|', '\\|')
for col in row
]
)
@@ -47,7 +47,7 @@ Return type: `User`
| `user_id` | `str` | normal | -- | -- |
| `name` | `str` | normal | -- | -- |
| `email` | `str` | normal | -- | -- |
| `age` | `int | None` | normal | `None` | -- |
| `age` | `int \| None` | normal | `None` | -- |
@@ -250,8 +250,8 @@ Return type: `int | float`
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `a` | `int | float` | normal | -- | The first number. |
| `b` | `int | float` | normal | -- | The second number. |
| `a` | `int \\| float` | normal | -- | The first number. |
| `b` | `int \\| float` | normal | -- | The second number. |
@@ -461,8 +461,8 @@ Return type: `int | float`
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `a` | `int | float` | normal | -- | The first number. |
| `b` | `int | float` | normal | -- | The second number. |
| `a` | `int \\| float` | normal | -- | The first number. |
| `b` | `int \\| float` | normal | -- | The second number. |
@@ -672,8 +672,8 @@ Return type: `int | float`
| Parameter | Type | Kind | Default value | Description |
| --- | --- | --- | --- | --- |
| `a` | `int | float` | normal | -- | The first number. |
| `b` | `int | float` | normal | -- | The second number. |
| `a` | `int \\| float` | normal | -- | The first number. |
| `b` | `int \\| float` | normal | -- | The second number. |
@@ -138,6 +138,72 @@ from src.jcloud_docsgen.core.python._core import _markdown_table
"""| a |
| --- |
| line1\nline2 |""",
),
(
['a'],
[('line1\nline2 | 2',)],
True,
False,
False,
'--',
"""| a |
| --- |
| line1\nline2 \\| 2 |""",
),
(
['a'],
[('line1\nline2 | 2',)],
True,
False,
True,
'--',
"""| a |
| --- |
| line1 line2 \\| 2 |""",
),
(
['a'],
[('1 | 2',)],
True,
False,
True,
'--',
"""| a |
| --- |
| 1 \\| 2 |""",
),
(
['a'],
[('1 |',)],
True,
False,
True,
'--',
"""| a |
| --- |
| 1 \\| |""",
),
(
['a'],
[('|',)],
True,
False,
True,
'--',
"""| a |
| --- |
| \\| |""",
),
(
['a'],
[('| 2',)],
True,
False,
True,
'--',
"""| a |
| --- |
| \\| 2 |""",
),
(
[],