Newer
Older
labs / tiddlers / system / macros / $__ou_macros_MenuKeys.tid
created: 20200703065308466
modified: 20200703103856073
tags: $:/tags/Macro
title: $:/ou/macros/MenuKeys
type: text/vnd.tiddlywiki

\define keys(path)
<$list filter="[[$path$]split[>]trim[]first[]]">
<kbd><<currentTiddler>></kbd>
</$list>
<$list filter="[[$path$]split[>]trim[]rest[]]">
&#x1690;&nbsp;<kbd><<currentTiddler>></kbd>
</$list>
\end

\define menu(path)
<$list filter="[[$path$]split[>]trim[]first[]]">
<kbd><<currentTiddler>></kbd>
</$list>
<$list filter="[[$path$]split[>]trim[]rest[]]">
&#x276D;&nbsp;<kbd><<currentTiddler>></kbd>
</$list>
\end

\define path(path)
<kbd><span>{{$:/core/images/folder}} $path$</span></kbd>
\end


!Usage:

!!UI navigation 
```
<<menu "File > New File > Blob">>
```
<<menu "File > New File > Blob">>

!! Keyboard shortcuts
```
<<keys "Ctrl > Alt > 7">>
```
<<keys "Ctrl > Alt > 7">>

!! Paths
```
<<path "Documents/Projects">>
```
<<path "Documents/Projects">>

You can use both forward and back slashes, and colons in the path, so can represent file paths in all operating systems:

<<path "/home/bob/Documents/file.txt">>
<<path "H:\Documents\file.txt">>

! NOTE

Be careful with spaces after the string parameter when using Markdown.  The following will render correctly using Wikitext tiddlers:

```
<<menu "A > B > C" >>
```

but will fail with Markdown tiddlers.  This is likely a bug in the Markdown parser.

To be safe, don't use a trailing space:

```
<<menu "A > B > C" >> # BAD
<<menu "A > B > C">>  # OK
```