Open psiloi opened 2 months ago
Hi @psiloi
The opening tag of the <div>
must be followed by two newlines, and the closing tag </div>
must be preceded by two newlines, in order to maintain block parsing mode. Otherwise, the parser switches to inline parsing mode for the body of the <div>
See https://tiddlywiki.com/#WikiText%20Parser%20Modes for an introduction of the topic.
Here's a modified version that works:
\function .nl() [charcode[10]]
<$let raw = {{{ [[one\n\ntwo\n\nthree]search-replace:g[\n],<.nl>] }}}
cooked= {{{ [[<div>\n\n$(raw)$\n\n</div>]substitute[]search-replace:g[\n],<.nl>] }}}
>
!! raw (<<raw>>)
<$wikify output=html mode=block name=wiki text=<<raw>>><<wiki>></$wikify>
!! cooked
<$wikify output=html mode=block name=wiki text=<<cooked>>><<wiki>></$wikify>
</$let>
(Note that I edited your post to add monospaced formatting so that the HTML tags show up properly).
Thank you @Jermolene But I'm afraid that I find the "wikitext parser modes" explanations a bit too obcure. They lak examples to offer clarity.
A caveat on the $wikify
widget about the need to be aware of those mechanisms (with a link to them) would be welcome within the explanations for the mode
parameter. I shall try to submit a PR for that, if you telle me here it could be accepted.
I find the "wikitext parser modes" explanations a bit too obcure. They lak examples to offer clarity.
Do these examples help you?
https://tiddlywiki.com/#WikiText%20parser%20mode%3A%20HTML%20examples
Describe the bug
Get a simple plain text with several paragraphs seprated by a blank line (pargraph01\n\npargraph02\n\nparagraph03).
Use the $wiikify widget to output html. The paragraph are translated beween
<p>
and</p>
. Fine.Now add
<div>
at the beginning of the text and</div>
at the end. $wikify won't anymore do the paragraphing.Expected behavior
Wiki paragraphs should have been translated as html paragraphs.
To Reproduce
import the test-wikify.json file. open the "test wikify" tiddlers and see how it is rendered. In the "cooked" part, "one two three" is in a single line instead of three paragrpahs.
test-wikify.json
Screenshots
TiddlyWiki Configuration
Desktop (please complete the following information):
Additional context
No response