TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.03k stars 1.19k forks source link

[IDEA] Thinking about a possibility to extend styled blocks with parameters eg: mode=block parameter #6908

Open pmario opened 2 years ago

pmario commented 2 years ago

From: [IDEA] multiline syntax for list wikitext elements #6905

we need a syntactic structure that can appear in inline contexts, but contain block content. It doesn't need to be a special capability of the list parser.

In context of styled blocks

Styled blocks already allow several lines of class and style definitions.

@@.tc-tiddler-frame
@@width:400px;
Some text
@@

It may be possible to extend it like this

@@.tc-tiddler-frame
@@width:400px;
@@mode=block;tag=div
Some text
@@

Just and idea, but I think it would be possible and is backwards compatible. .. The only problem is, that it's a bit of an "overload" ...

Alzacon commented 2 years ago

For the output html, we only need to distinguish:

Here an example of needed output:

<ul>
    <li>list item one</li>
    <li>list item two with 
        <pre><code>block of
code</code></pre></li>
    <li>list item <br>three</li>
</ul>

Just a crazy idea would be a especial parser rule for how the single carriage-return are parsed.

An alternative way to activate this special break rule could be @@+br;

The syntax started with @@+ could be used for new especial rules which are a applied to text inside of them. Just another crazy idea.

pmario commented 2 years ago

The mode=block rule is intended to be used like the mode=block for the transclusion-widget.

Try the following code. .. The heading will not be detected, because the parser is in "inline-mode" ... That's why we would need a mode=block

*@@.test some text
!! heading in the next line
@@

The linebreak "problem" can be solved with code at the other post: https://github.com/Jermolene/TiddlyWiki5/issues/6905#issuecomment-1215042576

Alzacon commented 2 years ago

We are talking about the same, "inline-mode" to parse in "block-mode", the result of parsing will be a block element. The difference is the syntax of the trigger. Also the utility class for linebreak can be used as trigger.

pmario commented 2 years ago

Also the utility class for linebreak can be used as trigger.

IMO it doesn't need special treating in the parser because it can be solved with CSS