-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Description
I always run Prettier on auto-generated Markdown files, including those made by ansible-doctor. Prettier is opiniated and replaces double underscores (__) in variable names with Markdown bold (**) in role READMEs generated by ansible-doctor. Prettier can NOT be configured to not replace __ with **.
Example:
# Original variable in defaults/main.yml
imapsync__logrotate__dependent_configGenerated README.md by ansible-doctor:
## Table of contents
- [Requirements](#requirements)
- [Default Variables](#default-variables)
- [imapsync__logrotate__dependent_config](#imapsync__logrotate__dependent_config)
...
## Default Variables
### imapsync__logrotate__dependent_configREADME.md after Prettier:
## Table of contents
- [Requirements](#requirements)
- [Default Variables](#default-variables)
- [imapsync**logrotate**dependent_config](#imapsync__logrotate__dependent_config)
...
## Default Variables
### imapsync**logrotate**dependent_configImpact
- TOC links break (
#imapsync__logrotate__dependent_configno longer matches) - Markdown linters (MD051) fail
- Variable names are misrepresented
Suggested fix
To render variable names literally, wrap them in backticks. Prettier will then not touch them.
## Table of contents
- [Requirements](#requirements)
- [Default Variables](#default-variables)
- [`imapsync__logrotate__dependent_config`](#imapsync__logrotate__dependent_config)
...
## Default Variables
### `imapsync__logrotate__dependent_config`Side effects
The variable names will be in a monospaced font in the rendered Markdown. Personally I actually see that as an improvement.
Steps to reproduce
- Create a variable with double underscores in a role.
- Run
ansible-doctorto generateREADME.md. - Observe
__. - Run
npx prettierto prettifyREADME.md. - Observe replacement of
__with**. - Run
ansible-doctoragain to generateREADME.md. - Observe
__. - Manually wrap
imapsync__logrotate__dependent_configin backticks. - Run
npx prettierto prettifyREADME.md. - Observe
__.
Minimal YAML snippet
# roles/test_role/defaults/main.yml
imapsync__logrotate__dependent_config:
- filename: imapsync
log: /var/log/imapsync.logEnvironment
- ansible-doctor version: 8.2.0
- OS: Ubuntu 24.04.3 LTS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels