feat: add config-option for fragment-index-divider (#20)

This commit is contained in:
Delta Umhöfer
2026-02-25 15:04:32 +01:00
committed by GitHub
parent f48932001a
commit 36ed1ee788
5 changed files with 47 additions and 1 deletions

View File

@@ -52,6 +52,8 @@ awesome.md:3 relative-links Relative links should be valid ["./invalid.txt" shou
- Support links fragments similar to the [built-in `markdownlint` rule - MD051](https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md) (e.g: `[Link](./awesome.md#heading)`).
- Ignore external links and absolute paths as it only checks relative links (e.g: `https://example.com/` or `/absolute/path.png`).
- If necessary, absolute paths can be validated too, with [`root_path` configuration option](#absolute-paths).
- Headings defined multiple times in one file, will get enumerated as `<heading><divider><count>`.
The divier can be customized with [`fragment-count-divider`](#divider-for-fragment-index).
### Limitations
@@ -128,6 +130,16 @@ After this change, all absolute paths will be converted to relative paths, and w
For example, if you run markdownlint from a subdirectory (if `package.json` is located in a subdirectory), you should set `root_path` to `".."`.
### Divider for Fragment-Index
Headers with the same name in the same file, are appended with their index when converting them to the fragment.
Between the original fragment and the index a divider will be inserted.
The final fragment is `<original-fragment><divider><index>`.
This divider can be configured with `fragment-index-divider` to accomodate different markdown-engines.
The default-value is `-`.
## Usage
```sh