Skip to content

fix: remove redundant # prefix from tag display#6

Open
victoraraujo105 wants to merge 1 commit intocallumalpass:mainfrom
victor-software-house:fix/double-hash-tag-display
Open

fix: remove redundant # prefix from tag display#6
victoraraujo105 wants to merge 1 commit intocallumalpass:mainfrom
victor-software-house:fix/double-hash-tag-display

Conversation

@victoraraujo105
Copy link

Summary

Tags display as ##task instead of #task because the CLI prepends # to tags that already have # from the API.

Root cause

The TaskNotes HTTP API returns tags from Obsidian's metadata cache, which always prepends # to frontmatter tag values (e.g. tags: [task] in YAML becomes ["#task"] in the cache/API response).

lib/utils.js unconditionally prepends another # for display:

// Line 45 - task list display
task.tags.map(tag => colors.highlight(`#${tag}`))
// "#" + "#task" = "##task"

// Line 128 - parsed task display
parsed.tags.map(tag => colors.info(`#${tag}`))

Fix

Remove the redundant # prefix. The API value already includes it:

task.tags.map(tag => colors.highlight(tag))
parsed.tags.map(tag => colors.info(tag))

Reproduction

# Create a task
tn create "Test task today #planning 15m"

# List tasks -- tags show ##task ##planning
tn list

# Check what the API actually returns
curl -s http://localhost:8080/api/tasks | python3 -c "
import sys, json
data = json.load(sys.stdin)
print(data['data']['tasks'][0]['tags'])
"
# Output: ['#task', '#planning']  -- already has #

After fix

Tags: #task #planning

The TaskNotes HTTP API returns tags with # prefix (from Obsidian's
metadata cache). The CLI was unconditionally prepending another #,
resulting in ##task display. Just display the API value as-is.
@victoraraujo105 victoraraujo105 force-pushed the fix/double-hash-tag-display branch from 5e460f4 to 01a1290 Compare February 15, 2026 21:19
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.

1 participant