Skip to content

An Obsidian plugin that enforces consistent markdown styling

License

Notifications You must be signed in to change notification settings

gavinmn/obsidian-linter

 
 

Repository files navigation

Build

Obsidian Linter

This Obsidian plugin applies consistent styling to your markdown files. Rules can be toggled and configured in the settings.

Usage

To lint the current file, run Lint the current file (Ctrl+Alt+L by default). To lint the all files, run Lint all files in the vault.

When Lint on save is toggled on, the plugin will lint the current file on save.

Disable rules

---
disabled rules: [ capitalize-headings ]
---

Add disabled rules: [ ... ] to the YAML frontmatter of a file to disable those rules when linting that file.

Add disabled rules: [ all ] to the YAML frontmatter of a file to disable all rules.

Development Instructions

Pull requests are welcome, especially for new rules.

  1. Clone the repository
  2. Run npm ci to install dependencies
  3. Add a new rule in rules.ts.
    1. Insert a new rule in the corresponding rule type(spacing, headings, etc)
    2. Follow the format of the existing rules
    3. Add tests for edge cases in test.ts
    4. You should probably use some helper functions from utils.ts, such as ignoreCodeBlocksAndYAML.
  4. Run npm run compile to build, generate documentation, and test the plugin.
  5. Run npm run lint to lint the plugin.

Make sure to use Node 15.x or higher.

Rules

Documentation for all rules can be found in the rules docs. The docs are updated before the plugin is released, so may not be completely accurate.

About

An Obsidian plugin that enforces consistent markdown styling

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.6%
  • JavaScript 1.4%