How to force Block Mode in a Widget

43 views
Skip to first unread message

Yaisog Bonegnasher

unread,
Aug 31, 2019, 5:50:22 AM8/31/19
to TiddlyWiki
Hi,
does anyone know of a way to have the content in a (custom) widget always rendered in block mode? If at all possible, I would like to avoid having to insert two line breaks after the widget's opening element.

Background: I'm using a custom widget to insert <div>s with the attribute "tabindex=-1" and an identifier attribute around sections of wikitext. I can the use the tm-focus-selector message to scroll the section into view on a button click. This way I can set up a tiddler ToC for long tiddlers that can navigate to individual sections. It's the next best thing to section links in TWC for me (if it were combined with tm-navigate).

<$sec title="Section Title">
Some wikitext, usually in the form of lists.
</$sec>

The title attribute is rendered as an H2, and the wikitext must be parsed in block mode in order for the lists to work. Currently, I need to insert an extra line break to achieve that, which reduces the readability of the wikitext in tiddlers with many sections.

Regards,
Yaisog

Jeremy Ruston

unread,
Aug 31, 2019, 11:20:07 AM8/31/19
to tiddl...@googlegroups.com
Hi Yaisog

All widgets are parsed by the HTML element parser, and it isn't currently possible for a specific widget to customise the parsing process. Instead, you can create a parser that implements a new wikitext construction with the syntax that you want (but that doesn't clash with the existing HTML element parser), and then generates an instance of your widget.

Best wishes

Jeremy


On 31 Aug 2019, at 10:50, Yaisog Bonegnasher <yai...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f9e87640-7960-4fcf-9002-2b65db7548b8%40googlegroups.com.

Yaisog Bonegnasher

unread,
Aug 31, 2019, 1:45:47 PM8/31/19
to TiddlyWiki
Thank you Jeremy for the quick reply.
Sounds like something that would be rather complicated to implement for relatively little gain. I had hoped there was a simpler solution.

Have a nice weekend,
Yaisog
Reply all
Reply to author
Forward
0 new messages