obsidian-map-view icon indicating copy to clipboard operation
obsidian-map-view copied to clipboard

Hide tag text from inline tag

Open chrispyles opened this issue 8 months ago • 2 comments

I am creating a map for planning a trip and using inline tags to change the map marker icons.

If I write something like

[a hotel](geo:...) tag:hotel

it shows up as

Image

in the rendered Markdown.

I tried hiding the tag text as an HTML comment or Obsidian comment but then the map marker rule is not applied. Is there a way to hide this text so it isn't displayed?

chrispyles avatar Apr 22 '25 02:04 chrispyles

Sorry, I'm not aware of any way to do that right now :( It should be possible to expand the Markdown post-processor of Map View (the mechanism that shows a popup with a map when you hover a geolink in a note) to give CSS classes to the inline tags, I'll add that to my backlog.

esm7 avatar Apr 22 '25 07:04 esm7

Hi! I was looking for the same solution and came up with the following css code as a workaround:

Solution for preview mode:

.cm-line:not(.cm-active) .geolink ~ .cm-url a.cm-underline {
	display: none;
}

This hides any tag that follows an in-line geolink and is in the form "tag:example". The tags are shown only when the line is active. This only works in preview mode (not source or reading) - that's the mode I primarily work in. I've been learning css in my free time so I'm sure there's a much neater way to do this, but this has worked for me so far.

I just played with reader mode a bit and the closest I got to "hiding" the text is changing the font-size and then fixing the font-size of the geolink. However, it hides all text in the same paragraph as the geolink (bullet points directly below the geolink do show up though). This is either helpful or useless, depending on how you are formatting your notes.

Idea for reader mode:

p:has(a[aria-label^="geo"]) {
	font-size: 0px;
}
p a[aria-label^="geo"] {
	font-size: var(--font-text-size);
}

I know this doesn't solve the issue but hopefully it helps in some way.

ShadedBlueDaisies avatar Oct 15 '25 19:10 ShadedBlueDaisies