Skip to content

Getting Started/Configuration/Global options: Excape '|' in table row for sd_fontawesome_latex - #297

Open
yvonnefroehlich wants to merge 1 commit into
executablebooks:mainfrom
yvonnefroehlich:fix-table-global-options
Open

Getting Started/Configuration/Global options: Excape '|' in table row for sd_fontawesome_latex#297
yvonnefroehlich wants to merge 1 commit into
executablebooks:mainfrom
yvonnefroehlich:fix-table-global-options

Conversation

@yvonnefroehlich

Copy link
Copy Markdown

The table for the "Global options" contains a small error in the row for sd_fontawesome_latex (please see https://sphinx-design.readthedocs.io/en/rtd-theme/get_started.html#global-options):

image

This is because the | in the doc_type is not escaped and thus considered for the table in markdown:

fontawesome_latex: bool|str=dc.field(
default=False,
metadata={
"validator": validate_fontawesome_latex,
"types": (bool, str),
"help": "Render fontawesome icons in LaTeX output: "
'False/"none", True/"fontawesome", or "fontawesome5"',
"doc_type": "bool | str",

doc_type is used for setting up the table via:

def_sd_config_options_table() ->str:
"""Generate a Markdown table of all sphinx-design configuration options,
from the ``SdConfig`` dataclass fields.
"""
rows= [
"| Name | Type | Default | Description |",
"| ---- | ---- | ------- | ----------- |",
]
forfieldindc.fields(SdConfig):
default= (
field.default_factory()
iffield.default_factoryisnotdc.MISSING
elsefield.default
)
type_str=field.metadata.get("doc_type", field.type)
rows.append(
f"| `sd_{field.name}` | `{type_str}` | `{default!r}` "
f"| {field.metadata.get('help', '')} |"
)
return"\n".join(rows)


Without escaping the |

| aaa | bbb |
| --- | --- |
| xxx | `yyy | zzz` | 

the resulting table looks like:

aaabbb
xxx`yyy

With escaping the | as \|

| aaa | bbb |
| --- | --- |
| xxx | `yyy \| zzz` | 

the resulting table looks like:

aaabbb
xxxyyy | zzz

@chrisjsewellchrisjsewell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@yvonnefroehlich@chrisjsewell