Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] --no-code-tag-removal flag allowing to make removal of backticks in TOC entries optional #153

Open
jofas opened this issue Aug 4, 2024 · 0 comments · May be fixed by #154
Open

Comments

@jofas
Copy link
Contributor

jofas commented Aug 4, 2024

Is your feature request related to a problem? Please describe.

CI in one of my projects started failing, because the generated TOC entries did not contain backticks. I.e. a headline:

# `Headline`

becomes a TOC entry

* [Headline](#headline)

Note the missing backticks ` in the generated TOC entry. My linter didn't like that and started failing CI.

Describe the solution you'd like

I'd like to have the option to generate a TOC entry:

* [`Headline`](#headline)

with the backticks present.

For this I propose a new CLI flag --no-code-tag-removal that when present disables the current logic removing the generated <code> and </code> tags and instead replaces them with a backtick again.

Describe alternatives you've considered

  1. Reverting parts of 1056956, namely this line:

    sed 's/<code>//g' | sed 's/<\/code>//g' |

    While I believe this was a rather arbitrary change of logic in response to Problem with a title with a backquote at the end #13, it would still be a breaking change just to revert it. There might be users that want backticks to be removed from the TOC.

  2. Adding a flag --remove-code-tags.

    While I find --remove-code-tags to be a better name than --no-code-tag-removal, it would reverse the logic of code tag removal and become a breaking change again, just like the first considered alternative. I.e. now the default is that backticks are removed. The proposed --no-code-tag-removal flag would change that, add backticks to the generated TOC entries again. --remove-code-tags would be the opposite, make code tags in the output the default (breaking change), allowing the user to opt out of this.

@jofas jofas linked a pull request Aug 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant