Style transcluded items

Boris Mann 11th September 2021 at 6:46am

When I transclude items with {{ }}, I'd like to have a subtle background to show that it's transcluded.

Automatically including a link to the transcluded item would be good to.

Searched for this and found some links in the archive:

Using this:

<section style="background-color:#e0e0e0;"><$transclude tiddler=<<currentTiddler>> mode="block" /></section>

Not quite working, maybe this is closer?

\define colortransclusion(tiddler)
@@background-color:#e0e0e0;<$transclude tiddler={{$tiddler$}} mode="block" />@@
\end

Also this plugin: https://tobibeer.github.io/tw5-plugins/#inc

Requires you to use slightly different syntax:

<<{ [[Tiddler Title]]>>

Messing with styles, which is itself an example of using the plugin:

$:/plugins/tobibeer/inc/styles

.tb-inc {
background-color: #F0F8FF;
padding: 2px 10px 2px 20px;
}

p.tbinc-title {
font-size: small;
text-align: right;
margin-right: 10px;
}

.tb-inc-controls{
margin-top:-2em;
padding: 5px;
display:none;
}
.tb-inc-tab-content .tb-inc{
margin:0;
padding:0;
position:relative;
}
.tb-inc-tab-content .tb-inc-controls{
position:absolute;
margin-top:-5px;
right:0;
top:0;
}
.tb-inc:hover > .tb-inc-controls{
display:block;
float:right;
}

Also edited $:/plugins/tobibeer/inc/macro to include a link to the tiddler at the bottom.