Skip to content

0.36.2

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Sep 20:25
· 32 commits to main since this release

fix(star): place star before Obsidian Tasks metadata

Fixes #475
Fixes #267

Problem

DataviewTask.addStar appended the star to the end of the task line:

lines[taskLineIdx] = lines[taskLineIdx] + " ⭐";

The Obsidian Tasks plugin parses its signifiers from the end of the line. A trailing ⭐ makes it stop early and absorb the last field into the description, so that field is silently dropped from Tasks queries:

- [ ] Write docs 🆔 abc123 ⛔ def456 ⭐     ← Tasks loses ⛔ def456

This is what @Octaeon reported in #475 (metadata emojis suddenly rendering in a query for starred tasks) and matches the "state gets lost" symptom in #267.

Fix

The star now goes at the end of the description, in front of the first Tasks signifier or Dataview inline field:

- [ ] Write docs ⭐ 🆔 abc123 ⛔ def456
  • TASKS_SIGNIFIERS / TASKS_METADATA_START_PATTERN in task-regex.ts locate where the trailing metadata block starts. Dataview inline fields ([id:: …], (dependsOn:: …)) count as metadata; brackets in the description (Read [book] later) and the checkbox itself do not.
  • addStarToTaskLine strips any existing star before re-inserting, so it is idempotent and repairs lines written by earlier versions.
  • addSignToTaskInFile normalizes the star position after writing a sign. Without this, adding a dependency to a note that still has a legacy trailing star would reproduce the original bug on an already-broken line — existing vaults now heal as tasks are edited.
  • removeStarFromTaskLine replaces a .trim() that was stripping the leading indentation of nested tasks.

Notes

The star remains a Tasks Map concept, so it still shows up as part of the description in Tasks queries — that is inherent to storing extra metadata on a - [ ] … line and is unchanged here. This PR only stops it from destroying other fields.

NoteTask is unaffected; it stores starred in frontmatter.

Testing

  • New unit tests for addStarToTaskLine, removeStarFromTaskLine, and normalizeStarPositionInTaskLine covering each signifier type, Dataview fields, tags, nested indentation, idempotency, and legacy repositioning.
  • Updated DataviewTask star tests to assert exact output rather than "contains ⭐".
  • Regression test for the legacy trailing star in addSignToTaskInFile.
  • Full suite: 326 passed. npm run build and npm run lint clean.

🤖 Generated with Claude Code