Not per se a TW question, but it is TW causing this difficulty with the targeting here:
As you know, paragraphs in the tiddler body automatically get wrapped in <p>
. Thus, in an arbitrary text I get an arbitrary number of p’s. In my case each paragraph can in turn contain an arbitrary number of <span>
s.
Question: How do I target the nth span in this?
Here’s a copy-pasteable tiddler text for easy try out. As you see, it half-works so the variables etc do work but the problem is the selector:
Lorem ipsum dolor sit amet, <span>ONE</span> consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua.
Pragrafus sin dividum.
Ut enim ad <span>TWO</span> minim veniam, quis nostrud
exercitation ullamco <span>THREE</span> laboris nisi ut aliquip
ex ea commodo consequat.
<style>
<$list filter="red blue green" counter=counter variable=color>
[data-tiddler-title="<<currentTiddler>>"] .tc-tiddler-body span:nth-of-type(<<counter>>) { background:<<color>>; }
</list>
</style>