Skip to content

fix(nlp): keep text inside links and inline code out of NLP (#2489) - #2490

Merged
callumalpass merged 3 commits into
mainfrom
fix/2489-nlp-links
Nov 3, 2026
Merged

callumalpass merged 3 commits into
mainfrom
fix/2489-nlp-links

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Fixes #2489.

Cause

The reported case (- [ ] review [[2026-11-03 Meeting with Jane]] scheduling 2026-11-03) came from tasknotes-nlp-core 0.1.5, which TaskNotes used up to 4.14.0 and which did not protect wikilinks. The core pinned since 4.15.0 does protect them, so that exact line no longer reproduces on main. Other paths still leaked:

  • TasksPluginParser (inline convert) took #tags / @contexts from anywhere in the line. - [ ] review [[Project#Next steps]] became a Next tag, and the title turned into [[Project steps]]. The same happened in markdown links and inline code.
  • Parser adapter (NaturalLanguageParser.parseInput) matched status/priority shortcuts against the raw input, so [[Meeting *done notes]] set status done.
  • NLP core did not protect markdown links or bare URLs: [notes 2026-11-03](notes.md) scheduled 2026-11-03 and lost the date from the link.

Change

  • New src/utils/markdownLiterals.ts replaces inline code, wikilinks, markdown links and bare URLs with placeholders. TasksPluginParser (tags, contexts, clean title) and the adapter's localized-label rewrite and status/priority token checks run on the shielded text.
  • Pins tasknotes-nlp-core to the merge commit of Keep markdown links and bare URLs whole during parsing (tasknotes#2489) tasknotes-nlp-core#10 (747675e), which protects markdown links and URLs alongside wikilinks.
  • Triggers before a link still work: +[[project]] and user-field links like client:[[Acme]].
  • Every NLP entry point goes through the adapter: inline convert, create modal / task selector, JS API parseNaturalLanguage, HTTP API, MCP and CLI.
  • Backtick spans keep their existing [FR]: NLP should have an "Ignore" option #1475 behaviour: contents are literal and the backticks are dropped from the NLP title.

Tests

  • tests/unit/issues/issue-2489-nlp-links.test.ts, using the real chrono/date-fns: wikilink, markdown link and URL cases across en/de/fr/es/it/ja/ru, the +[[project]] trigger, and a TasksPluginParser title/tag case. Without the source changes, 8 of these fail.
  • e2e/issues/issue-2489-nlp-link-dates.spec.ts in an isolated Obsidian 1.15.0 instance: inline convert of the reported line, a line with link/code markup, +[[project]] tomorrow, the JS API, and create-modal highlighting (only tomorrow is highlighted).
  • Local: lint, typecheck, jest (6001 passed), test:fresh-catalogues, docs:check, build, bundle size (4.37 MB of 5 MB), and e2e/tasknotes.spec.ts with the new spec (113 passed, 92 skipped).

Converting an inline task could read task syntax from inside links:
TasksPluginParser took #tags and @contexts from wikilinks, markdown links and
inline code (`[[Project#Next steps]]` became a "Next" tag and lost "#Next"),
the adapter matched status shortcuts such as `*done` inside a link, and the
NLP core parsed dates inside markdown links and bare URLs.

Shield links and inline code in TasksPluginParser and the parser adapter, and
pin tasknotes-nlp-core to the commit that protects markdown links and URLs
alongside wikilinks. Triggers before a link, such as +[[project]], still apply.
@callumalpass
callumalpass merged commit 09d685f into main Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: NLP parses a link in inline tasks

1 participant