[GH-ISSUE #1208] MD014: Support # and %, not just the $ sign #2489

Open
opened 2026-03-07 20:08:14 +03:00 by kerem · 2 comments
Owner

Originally created by @its-miroma on GitHub (May 12, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1208

The bash prompt by default shows a # when it's running as root, $ otherwise.
C-style shells, on the other hand, use the % symbol.

However, MD014 only warns about the $ prompt. That should be configurable, for example:

MD014:
  languages:
    - bash:
      - '$'
      - '#'
    - csh:
      - '%'
Examples

please do not run the commands reported in the examples lol

Example 1

$ :(){ :|:& };:
[1] 1234

No warning, as expected

Example 2

$ :(){ :|:& };: &> /dev/null

Warning, as expected

Example 3

# :(){ :|:& };:
[1] 1234

No warning, as expected

Example 4

# :(){ :|:& };: &> /dev/null

No warning, unexpected?

Example 5

$ sudo su
[sudo] password for user: 
# :(){ :|:& };: &> /dev/null

No warning, as expected

Example 6

$ pkexec
# :(){ :|:& };: &> /dev/null

No warning, unexpected?

Originally created by @its-miroma on GitHub (May 12, 2024). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1208 The bash prompt by default shows a `#` when it's running as root, `$` otherwise. C-style shells, on the other hand, use the `%` symbol. However, `MD014` only warns about the `$` prompt. That should be configurable, for example: ```yaml MD014: languages: - bash: - '$' - '#' - csh: - '%' ``` <details> <summary>Examples</summary> _please do not run the commands reported in the examples lol_ ## Example 1 ```bash $ :(){ :|:& };: [1] 1234 ``` No warning, as expected ## Example 2 ```bash $ :(){ :|:& };: &> /dev/null ``` Warning, as expected ## Example 3 ```bash # :(){ :|:& };: [1] 1234 ``` No warning, as expected ## Example 4 ```bash # :(){ :|:& };: &> /dev/null ``` **No warning, unexpected?** ## Example 5 ```bash $ sudo su [sudo] password for user: # :(){ :|:& };: &> /dev/null ``` No warning, as expected ## Example 6 ```bash $ pkexec # :(){ :|:& };: &> /dev/null ``` **No warning, unexpected?** </details>
Author
Owner

@DavidAnson commented on GitHub (May 13, 2024):

I think the rule does not recognize hash as a dollar alternative. (The unconditional rendering of hash lines as comments is a GitHub behavior.) I'd be inclined to make what's probably a simple change to address this in the rule, but I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior. In other words, I worry that a simple fix may make things worse instead of better. This is the first time I remember the issue coming up, so the problem you raise may be relatively rare. I'm open to more input on the matter.

<!-- gh-comment-id:2106556714 --> @DavidAnson commented on GitHub (May 13, 2024): I think the rule does not recognize hash as a dollar alternative. (The unconditional rendering of hash lines as comments is a GitHub behavior.) I'd be inclined to make what's probably a simple change to address this in the rule, but I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior. In other words, I worry that a simple fix may make things worse instead of better. This is the first time I remember the issue coming up, so the problem you raise may be relatively rare. I'm open to more input on the matter.
Author
Owner

@its-miroma commented on GitHub (May 13, 2024):

I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior.

Yes, that is by far the most common

the problem you raise may be relatively rare

I've seen it, but very rarely. You're right


It may be worth it though to support the % symbol used by C Shell and variants,
but I'm not familiar with those. See https://superuser.com/questions/57575/what-is-the-origin-of-the-unix-dollar-prompt

<!-- gh-comment-id:2106782260 --> @its-miroma commented on GitHub (May 13, 2024): > I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior. Yes, that is by far the most common > the problem you raise may be relatively rare I've seen it, but very rarely. You're right --- It may be worth it though to support the `%` symbol used by C Shell and variants, but I'm not familiar with those. See <https://superuser.com/questions/57575/what-is-the-origin-of-the-unix-dollar-prompt>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2489
No description provided.