Skip to content

Ensures that wikilinks in markdown notes in apps like logseq, obsidian, etc point to existing pages, are as verbose as possible, and many other relevant lints.

License

Notifications You must be signed in to change notification settings

ryanpeach/mdlinker

Repository files navigation

MdLinker

A linter whose goal is to lint wikilinks in a variety of markdown note taking apps to enable maximal networked thinking.

Uses miette for beautiful 🦀 rust style error messages. 🦀

Uses git pre-commit to integrate with your git workflow.

- repo: https://github.com/ryanpeach/mdlinker
  rev: <VERSION>
  hooks:
    - id: mdlinker

NOTE: Linking works best when you spell things correctly, in both your filenames and file contents. Consider pairing this tool with a spell checker.

Configuration

Put a mdlinker.toml in your project root to configure the linter.

Options are defined in src/config/file.rs as a serde object, and can be overwritten in the cli, see mdlinker --help.

Lint Rules

  • Similar Files: Two files share a very similar title. Maybe you should combine them! Uses a fuzzy finder and ngram similarity. O(n^2) complexity in the number of files.
  • Duplicate Alias: If using something like logseq aliases, make sure they are always unique (also compares them to filenames).
  • Broken Wikilink: Some wikilinks linked resource does not exist. Maybe you should create the page, or maybe the link title is misspelled?
  • Unlinked Text: Text was detected which is very similar to some file title or alias. Maybe you should wrap it as a link?
  • RelatesTo: At least in logseq, I find it annoying the graph wont show two items as linked if they are linked within the same block. These will identify that and force you to link them in the frontmatter.
    • RelatesToParagraph: Two wikilinks in the same paragraph
    • RelatesToListItem: Two wikilinks in the same list item
    • RelatesToListItemDescendant: One wikilink in a sublist item of another wikilinks listitem
    • RelatesToNotFound: delete a relation which doesnt match any of the above for cleanliness

Future

  • LSP Implementation
  • Logseq Plugin

Compatibility

  • Logseq Folder Structure
  • Logseq Hierarchy
  • Yaml Front Matter
  • Logseq Aliases (in Yaml Front Matter)
  • [[url]] and [[title|url]] style wikilinks
  • #[[url]] and #url tags
  • Marksman [[#url]] tags
  • Logseq properties ":: style" (Won't implement, use yaml front matter)
  • Obsidian Folder Structure (Unknown, PRs welcome)
  • Obsidian Aliases (Unknown, PRs welcome)
  • Marksman

About

Ensures that wikilinks in markdown notes in apps like logseq, obsidian, etc point to existing pages, are as verbose as possible, and many other relevant lints.

Resources

License

Stars

Watchers

Forks

Packages

No packages published