Open Bad3r opened 1 week ago
Hey @Bad3r . Thanks for the request. Is there a reason you are not trying to solve this via a custom replacement (i.e. regex)?
Hey @Bad3r . Thanks for the request. Is there a reason you are not trying to solve this via a custom replacement (i.e. regex)?
While it's possible to solve by regex I feel like it's a common use case. For example, GitHub automatically does that for markdown files.
It would be a great & “simple” feature to add.
Hey @Bad3r . Thanks for the request. Is there a reason you are not trying to solve this via a custom replacement (i.e. regex)?
I am having an issue with regex sloution..
I am using the following:
(## [^\n]+)\n(?!---)
$1\n---\n
even though the find regex should exclude H2 headers that are already followed by a horizontal line ((?!---)
) the linter matches them and endlessly adds a new horizontal line after every H2.
When I text it in regex 101 (https://regex101.com/) the issue is not reproducible
link to test: https://regex101.com/r/npn3HT/1
test case:
## Header A
---
## Header B
test
## header C
Hey @Bad3r . Thanks for the request. Is there a reason you are not trying to solve this via a custom replacement (i.e. regex)?
I am having an issue with regex sloution..
I am using the following:
- find regex
(## [^\n]+)\n(?!---)
- the replace regex
$1\n---\n
even though the find regex should exclude H2 headers that are already followed by a horizontal line (
(?!---)
) the linter matches them and endlessly adds a new horizontal line after every H2.When I text it in regex 101 (https://regex101.com/) the issue is not reproducible
link to test: https://regex101.com/r/npn3HT/1
test case:
## Header A --- ## Header B test ## header C
I will have to take a look at this when I get a chance. It could be that the regex is getting escaped improperly which could cause the issue.
Hey @Bad3r . Thanks for the request. Is there a reason you are not trying to solve this via a custom replacement (i.e. regex)?
I am having an issue with regex sloution.. I am using the following:
- find regex
(## [^\n]+)\n(?!---)
- the replace regex
$1\n---\n
even though the find regex should exclude H2 headers that are already followed by a horizontal line (
(?!---)
) the linter matches them and endlessly adds a new horizontal line after every H2. When I text it in regex 101 (regex101.com) the issue is not reproducible link to test: regex101.com/r/npn3HT/1 test case:## Header A --- ## Header B test ## header C
I will have to take a look at this when I get a chance. It could be that the regex is getting escaped improperly which could cause the issue.
Fixed it by using the regex (## [^\n]+)\n(?!\s*---)
its not an escaping issue but seems like something I was using wasn't supported by the engine.
I still think this should be a builtin feature. Feel free to close if you disagree.
Is Your Feature Request Related to a Problem? Please Describe.
Automatically add a horizontal line or horizontal rule after type 2 headings or 1
Describe the Solution You'd Like
A toggle option to enable automatically adding a horizontal line after H2 heading
Please include an example where applicable:
Describe Alternatives You've Considered
A clear and concise description of any alternative solutions or features you've considered.
Additional Context
Add any other context or screenshots about the feature request here.