An approach for a handy-dandy link list of macros

(Relevant export of tiddler attached.)

A no-fuss no-muss sorted list, displayed in a sidebar tab, of all macros in all tiddlers tagged as macro tiddlers.

Screenshots followed by the code.

\define d() \\

<$let m={{{ [tag[$:/tags/Macro]!is[draft]get[text]join[...]] }}} >
  <$list filter="[<m>split[...]search-replace:g:regexp[\n],[:::]split[:::]regexp<d>search-replace:g:regexp<d>,[]sort[]]">
    <$let l={{{ [{!!title}search-replace[(],[\(]search-replace[)],[\)]search-replace[)],[):::]split[:::]nth[1]] }}}>
    <$link to={{{ [tag[$:/tags/Macro]!is[draft]regexp:text<l>] }}}>
      <$text text={{{ [{!!title}removeprefix[define ]search-replace[)],[):::]split[:::]nth[1]] }}}/>
    </$link> <br>
    </$let>
  </$list>

</$let>

Macros in Macro Tiddlers.json (738 Bytes)

Oops, in making sure I only get lines that start with a backslash, I forgot to exclude lines that have \end.

Modified code:

  • added the e macro
  • added !regexp<e> to the list widget’s filter
\define d() \\
\define e() \\end

<$let m={{{ [tag[$:/tags/Macro]!is[draft]get[text]join[...]] }}} >
  <$list filter="[<m>split[...]search-replace:g:regexp[\n],[:::]split[:::]!regexp<e>regexp<d>search-replace:g:regexp<d>,[]sort[]]">
    <$let l={{{ [{!!title}search-replace[(],[\(]search-replace[)],[\)]search-replace[)],[):::]split[:::]nth[1]] }}}>
    <$link to={{{ [tag[$:/tags/Macro]!is[draft]regexp:text<l>] }}}>
      <$text text={{{ [{!!title}removeprefix[define ]search-replace[)],[):::]split[:::]nth[1]] }}}/>
    </$link> <br>
    </$let>
  </$list>

</$let>