TiddlyWiki5/editions/tw5.com/tiddlers/macros/TagMacro.tid

46 lines
1.4 KiB
Plaintext

caption: tag
created: 20141206130540337
modified: 20240228131301798
tags: Macros [[Core Macros]]
title: tag Macro
type: text/vnd.tiddlywiki
The <<.def tag>> [[macro|Macros]] generates a tag pill for a specified tag. Clicking the tag pill opens a dropdown. This can be compared to the [[tag-pill Macro]] which also features other parameters.
<<.tip """If a [[list widget|ListWidget]] generates multiple tag macros for the same tag, clicking on one of them will open dropdowns on all of them. The simplest way to prevent this is to add the `counter="transclusion"` attribute to the list widget. See the examples below for more details.""">>
!! Parameters
; tag
: The title of the tag, defaulting to the [[current tiddler|Current Tiddler]]
!! CSS classes
<<.from-version "v5.3.4">>
; `tc-tag-missing`
: This class is defined if a tag does ''not exist'' as a tiddler.
; `tc-tag-exists`
: This class is defined if a tag does exist as a tiddler
!!! Defining the class
To define the `tc-tag-missing` class a stylesheet tiddler needs to be created. The default font-style for missing tiddler links is //italic//, so it's used for the example code below. Eg:
''title:'' `myTagsStylesheet`<br>
''tag:'' `$:/tags/Stylesheet`
<<copy-to-clipboard-above-right src:"""
.tc-tag-missing {
font-style: italic;
}
""">>
```
.tc-tag-missing {
font-style: italic;
}
```
<<.macro-examples "tag">>