Exempt Lapis tag lines from markdownlint MD018 #161

Closed
opened 2026-05-30 23:00:50 +00:00 by steve · 0 comments
Owner

Stock markdownlint MD018 flags valid Lapis tag lines such as #task and #project/roadmap as missing-space ATX headings.

Problem

In-app markdown lint uses { default: true }, so MD018 reports false positives on lowercase tag lines and line-start tag prefixes that Lapis treats as tags, not headings.

Goal

Disable stock MD018 and replace it with a Lapis custom rule that preserves MD018 behavior for malformed ATX headings while exempting lowercase tag lines.

Scope

  • Custom MD018 rule in @lapis-notes/language-service with tag exemption
  • Shared lint options used by browser worker and Electron sidecar
  • Unit tests and markdown-lint plugin spec update

Non-goals

  • Changing .markdownlint-cli2.jsonc CI config
  • General markdownlint rule-config passthrough

Acceptance Criteria

  • Stock MD018 disabled by default in in-app lint config
  • Custom MD018 rule exempts whole-line tags: #task, #project/roadmap, indented #task
  • Custom MD018 rule exempts line-start tag prefixes: #task Buy milk
  • Custom MD018 still reports: #Introduction, ##Section, ###foo, #bad
  • Quick-fix (insert space after #) preserved for violations
  • Vault disabledRules: ["MD018"] suppresses the replacement rule
  • Spec documents the behavior

Implementation Notes

  • Tag pattern: optional 0–3 space indent, single #, lowercase-first name [a-z][a-z0-9_/-]*, followed by EOL or whitespace
  • Rule names: MD018, no-missing-space-atx-except-tags

Suggested Files or Specs To Inspect

  • packages/language-service/src/workers/markdownlint.worker.ts
  • packages/desktop-electron/src-electron/language-service-sidecar-child.ts
  • packages/plugins/plugin-markdown/src/lib/remark-plugins/tag.ts
  • spec/src/20-packages/plugins/markdown-lint/index.md

Validation Commands

  • pnpm --filter @lapis-notes/language-service test
  • pnpm --filter @lapis-notes/language-service check:all
  • pnpm --filter @lapis-notes/desktop-electron check:types
  • pnpm test:smoke

Follow-up Tasks

Implementation Summary

Disabled stock MD018 in in-app markdownlint config and added a Lapis MD018-lapis custom rule that exempts lowercase tag lines and line-start tag prefixes. Shared createMarkdownlintLintOptions() wires browser worker and Electron sidecar; diagnostics still surface as MD018. Validated with language-service unit tests and package typechecks.

Stock markdownlint MD018 flags valid Lapis tag lines such as `#task` and `#project/roadmap` as missing-space ATX headings. ## Problem In-app markdown lint uses `{ default: true }`, so MD018 reports false positives on lowercase tag lines and line-start tag prefixes that Lapis treats as tags, not headings. ## Goal Disable stock MD018 and replace it with a Lapis custom rule that preserves MD018 behavior for malformed ATX headings while exempting lowercase tag lines. ## Scope - Custom MD018 rule in `@lapis-notes/language-service` with tag exemption - Shared lint options used by browser worker and Electron sidecar - Unit tests and markdown-lint plugin spec update ## Non-goals - Changing `.markdownlint-cli2.jsonc` CI config - General markdownlint rule-config passthrough ## Acceptance Criteria - [ ] Stock MD018 disabled by default in in-app lint config - [ ] Custom MD018 rule exempts whole-line tags: `#task`, `#project/roadmap`, indented ` #task` - [ ] Custom MD018 rule exempts line-start tag prefixes: `#task Buy milk` - [ ] Custom MD018 still reports: `#Introduction`, `##Section`, `###foo`, `#bad` - [ ] Quick-fix (insert space after `#`) preserved for violations - [ ] Vault `disabledRules: ["MD018"]` suppresses the replacement rule - [ ] Spec documents the behavior ## Implementation Notes - Tag pattern: optional 0–3 space indent, single `#`, lowercase-first name `[a-z][a-z0-9_/-]*`, followed by EOL or whitespace - Rule names: `MD018`, `no-missing-space-atx-except-tags` ## Suggested Files or Specs To Inspect - `packages/language-service/src/workers/markdownlint.worker.ts` - `packages/desktop-electron/src-electron/language-service-sidecar-child.ts` - `packages/plugins/plugin-markdown/src/lib/remark-plugins/tag.ts` - `spec/src/20-packages/plugins/markdown-lint/index.md` ## Validation Commands - `pnpm --filter @lapis-notes/language-service test` - `pnpm --filter @lapis-notes/language-service check:all` - `pnpm --filter @lapis-notes/desktop-electron check:types` - `pnpm test:smoke` ## Related Issues ## Follow-up Tasks ## Implementation Summary Disabled stock MD018 in in-app markdownlint config and added a Lapis MD018-lapis custom rule that exempts lowercase tag lines and line-start tag prefixes. Shared createMarkdownlintLintOptions() wires browser worker and Electron sidecar; diagnostics still surface as MD018. Validated with language-service unit tests and package typechecks. <!-- backlog:task_id=TASK-MD018-TAGS source_spec=spec/src/20-packages/plugins/markdown-lint/index.md -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lapis-notes/lapis#161
No description provided.