Skip to content

Commit a6ff7c3

Browse files
authored
Fix link to headings with 2 tags (#844)
* test: Add sample heading with 2 tags, to test #842 * fix: Use global substitution to replace all # in headings Fixes #842
1 parent f5921e0 commit a6ff7c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

resources/sample_vaults/Tasks-Demo/Manual Testing/654 - Unable to find section, when title has tag inside.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- [Unable to find section, when title has tag inside · Issue #654 · obsidian-tasks-group/obsidian-tasks · GitHub](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/654)
44

5-
## Section with tag in #example-tag
5+
## Section with tag in #example-tag and #another-tag
66

77
- [ ] #task Task in section with tag in heading name
88

src/QueryRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class QueryRenderChild extends MarkdownRenderChild {
297297
}
298298

299299
if (task.precedingHeader !== null) {
300-
const sanitisedHeading = task.precedingHeader.replace('#', '');
300+
const sanitisedHeading = task.precedingHeader.replace(/#/g, '');
301301
link.href = link.href + '#' + sanitisedHeading;
302302
link.setAttribute(
303303
'data-href',

0 commit comments

Comments
 (0)