How to transclude a list and modify its indentation level automatically to match the destination tiddler indentation level

39 views
Skip to first unread message

Eric N

unread,
Mar 23, 2022, 5:05:15 AM3/23/22
to TiddlyWiki
Hi,

I have a list in a tiddler A, and I want to transclude it into a tiddler B while adapting the list indentation to the level where it is inserted in B.

Say A is:
* this
* that

And B is:
* 1
* 2
* 3
** 3.1
** 3.2

Then I want to type a command in B:
* 1
* 2
* 3
** 3.1
INSERT_WITH_INDENT(A)
** 3.2

In order to obtain:
* 1
* 2
* 3
** 3.1
*** this
*** that
** 3.2

And not what a standard transclusion with {{A}} would give:

* 1
* 2
* 3
** 3.1
* this
* that
** 3.2

Does it make sense ? Any idea how to do it ?

For info, I work with lists a lot, and I'd like to reuse information without copy pasting, and the places I want to reuse a given list are lists themselves, however with different indentation levels.

Best,
Eric

Eric Shulman

unread,
Mar 23, 2022, 5:46:24 AM3/23/22
to TiddlyWiki
First, you'll need to use the `<$transclude>` widget with optional parameter `mode=block`.  This will allow the transclusion to properly handle the bullet items contained in the transcluded tiddler.

Then, to insert the transcluded bullet items at a level below the current level, you'lll need to put the `<$transclude>` widget on the same line as the item that is it's "parent" in the target bullet list.

Like this:
```
* Foo
* Bar
* Baz
** Mumble
** Frotz <$transclude tiddler="A" mode=block/>
** Gronk
```

The result should look like this:
  • Foo
  • Bar
  • Baz
    • Mumble
    • Frotz
      • this
      • that
    • Gronk
enjoy,
-e

Eric N

unread,
Mar 23, 2022, 6:19:21 AM3/23/22
to TiddlyWiki
Thank you so much !
Reply all
Reply to author
Forward
0 new messages