Background highlights for tags in a theme


#1

In older versions of FoldingText, I was able to highlight tagged text with this:

div[hl] span[class~=text] {
    background: rgb(255, 255, 0); }

How can I accomplish the same in user.less?


Adding a note to a task, scripting Taskpaper
#2

There are some helpful examples at the bottom of the page under FT > Help > Software Development Kit > Documentation > Tutorials > Create Themes

( x-foldingtext://sdk/docs from the browser )

//
// Change style based on @tags
//

// Color text orange when tagged with "@priority"
pre[cm-priority] span.cm-text {
    color: orange;
}

// Color text red when tagged with "@priority(1)"
pre[cm-priority="1"] span.cm-text {
    color: red;
}

#3

Check this out:


#4

Any suggestions for how this might work with due dates? For example, red highlight for a due date that’s passed, and green for a future due date, or something such…


#5

@JSLR Getting tags with due dates to change style based on due date time would require a bit more work.

The problem is that in that case the style state won’t only depend on the text content in the document… it will also depend on the current system time. To make it work there needs to be some code that runs in the background noting when tags become overdue, etc.

In the next release I’ve done some work on standardizing how dates are handled in FoldingText… once that is out writing this sort of plugin will be easier… so maybe bring this up again after FoldingText 2.1 if you still want it.


#6

Ah— understood. Thanks.


#7

Is there an easy way to specify conditional formatting in an example like this without having to write a plugin? So, rather than having to define state for a series of different priority levels, is there a way of defining state for cm-priority <= 2?

I’ve been looking at LESS when statements, but don’t quite have my head around them yet…