Skip to content

Commit 0e1da47

Browse files
committed
fix: Escape pipes in table cells
Issue-22: #22
1 parent 11fa76d commit 0e1da47

8 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/griffe2md/templates/docstring/attributes.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description
66
---- | ---- | -----------
77
{%- for attribute in section.value %}
8-
[`{{ attribute.name }}`](#{{ obj.path }}.{{ attribute.name }}) | {% if attribute.annotation -%}{%- with expression = attribute.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ attribute.description|newline_to_br }} }}
8+
[`{{ attribute.name }}`](#{{ obj.path }}.{{ attribute.name }}) | {% if attribute.annotation -%}{%- with expression = attribute.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ attribute.description|newline_to_br }} }}
99
{%- endfor -%}
1010

1111
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/other_parameters.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description
66
---- | ---- | -----------
77
{%- for parameter in section.value %}
8-
`{{ parameter.name }}` | {% if parameter.annotation -%}{%- with expression = parameter.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ parameter.description|newline_to_br }}
8+
`{{ parameter.name }}` | {% if parameter.annotation -%}{%- with expression = parameter.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ parameter.description|newline_to_br }}
99
{%- endfor -%}
1010

1111
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/parameters.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description | Default
66
---- | ---- | ----------- | -------
77
{%- for parameter in section.value %}
8-
`{{ parameter.name }}` | {% if parameter.annotation -%}{%- with expression = parameter.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ parameter.description|newline_to_br }} | {% if parameter.default -%}{%- with expression = parameter.default -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- else -%}*required*{%- endif %}
8+
`{{ parameter.name }}` | {% if parameter.annotation -%}{%- with expression = parameter.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ parameter.description|newline_to_br }} | {% if parameter.default -%}{%- with expression = parameter.default -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- else -%}*required*{%- endif %}
99
{%- endfor -%}
1010

1111
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/raises.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Type | Description
66
---- | -----------
77
{% for raises in section.value %}
8-
{%- if raises.annotation -%}{%- with expression = raises.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif -%} | {{ raises.description|newline_to_br }}
8+
{%- if raises.annotation -%}{%- with expression = raises.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif -%} | {{ raises.description|newline_to_br }}
99
{% endfor %}
1010

1111
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/receives.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% if name_column -%}Name | {% endif -%}Type | Description
77
{% if name_column -%}---- | {% endif -%}---- | -----------
88
{% for receives in section.value %}
9-
{%- if name_column -%}{%- if receives.name -%}`{{ receives.name }}`{%- endif %} | {% endif %}{% if receives.annotation -%}{%- with expression = receives.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ receives.description|newline_to_br }}
9+
{%- if name_column -%}{%- if receives.name -%}`{{ receives.name }}`{%- endif %} | {% endif %}{% if receives.annotation -%}{%- with expression = receives.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ receives.description|newline_to_br }}
1010
{% endfor %}
1111

1212
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/returns.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% if name_column -%}Name | {% endif -%}Type | Description
77
{% if name_column -%}---- | {% endif -%}---- | -----------
88
{% for returns in section.value %}
9-
{%- if name_column -%}{%- if returns.name -%}`{{ returns.name }}`{%- endif %} | {% endif %}{% if returns.annotation -%}{%- with expression = returns.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ returns.description|newline_to_br }}
9+
{%- if name_column -%}{%- if returns.name -%}`{{ returns.name }}`{%- endif %} | {% endif %}{% if returns.annotation -%}{%- with expression = returns.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ returns.description|newline_to_br }}
1010
{% endfor %}
1111

1212
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/warns.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Type | Description
66
---- | -----------
77
{% for warns in section.value %}
8-
{%- if warns.annotation -%}{%- with expression = warns.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif -%} | {{ warns.description|newline_to_br }}
8+
{%- if warns.annotation -%}{%- with expression = warns.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif -%} | {{ warns.description|newline_to_br }}
99
{% endfor %}
1010

1111
{%- elif config.docstring_section_style == "list" %}

src/griffe2md/templates/docstring/yields.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% if name_column -%}Name | {% endif -%}Type | Description
77
{% if name_column -%}---- | {% endif -%}---- | -----------
88
{% for yields in section.value %}
9-
{%- if name_column -%}{%- if yields.name -%}`{{ yields.name }}`{%- endif %} | {% endif -%}{%- if yields.annotation -%}{%- with expression = yields.annotation -%}<code>{%- include "expression.md.jinja" with context -%}</code>{%- endwith -%}{%- endif %} | {{ yields.description|newline_to_br }}
9+
{%- if name_column -%}{%- if yields.name -%}`{{ yields.name }}`{%- endif %} | {% endif -%}{%- if yields.annotation -%}{%- with expression = yields.annotation -%}<code>{% filter replace("|", "\\|") %}{%- include "expression.md.jinja" with context -%}{% endfilter %}</code>{%- endwith -%}{%- endif %} | {{ yields.description|newline_to_br }}
1010
{% endfor %}
1111

1212
{%- elif config.docstring_section_style == "list" %}

0 commit comments

Comments
 (0)