-
Notifications
You must be signed in to change notification settings - Fork 730
Open
Labels
enhancementNew feature or requestNew feature or requestfoam-coreRelated to API, core model or featureRelated to API, core model or featuregood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Milestone
Description
Issue: foam.edit.linkReferenceDefinitions vs markdownlint (MD053)
Workaround: set
foam.edit.linkReferenceDefinitions
tooff
when using markdownlint
Environment
- VS Code
- Foam extension
- markdownlint extension (as default formatter)
Problem
When foam.edit.linkReferenceDefinitions
is not set to off
, Foam appends an autogenerated block:
[//begin]: # "Autogenerated link references for markdown compatibility"
[example-note]: path/to/example-note.md "Example Note"
[//end]: # "Autogenerated link references"
markdownlint (rule MD053) flags:
- Unused definitions:
[//begin]
and[//end]
- After save cycles, markdownlint may autofix; Foam may re-add the block, resulting in duplicate link definitions and MD053 warnings.
- Resulting in editor flicker (Foam adds / formatter removes), noisy diffs, and duplicated blocks.
Expected behavior
- Foam appends an autogenerated block without
[//begin]
and[//end]
autogenerated strings
[example-note]: path/to/example-note.md "Example Note"
Reproduction
-
Set:
"foam.edit.linkReferenceDefinitions": "withExtensions", "[markdown]": { "editor.defaultFormatter": "DavidAnson.vscode-markdownlint", "editor.formatOnSave": true }
-
Create a file with wikilinks:
[[example-note]]
-
Save repeatedly
-
Observe MD053 warnings and block churn
Solutions / Workarounds (I picked the first one)
-
Disable Foam link reference generation (simplest):
"foam.edit.linkReferenceDefinitions": "off"
Then suppress VS Code’s missing reference warnings:
"markdown.validate.referenceLinks.enabled": "ignore"
-
Keep Foam, adjust markdownlint to ignore sentinel markers:
.markdownlint.json:{ "MD053": { "ignored_definitions": ["//begin", "//end"] } }
-
Keep Foam, locally disable MD053 around the block:
<!-- markdownlint-disable MD053 --> [//begin]: # "Autogenerated link references for markdown compatibility" ... [//end]: # "Autogenerated link references" <!-- markdownlint-enable MD053 -->
-
Avoid wikilinks; use standard reference links (Foam preview will not resolve them):
See [Example][example-note] [example-note]: path/to/example-note.md
Sample Minimal Settings (Workarounds 1)
{
"foam.edit.linkReferenceDefinitions": "off",
"markdown.validate.referenceLinks.enabled": "ignore",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
"editor.formatOnSave": true
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfoam-coreRelated to API, core model or featureRelated to API, core model or featuregood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed