> Let's make a step aside here. Another -- rather "simple" formatter I
> want to implement is this: recognize
>
> <br
> />
>
> as break. In this context the question is how to do this so that in
> lists it should also work so that instead of writing
>
> * first line<br />/%
> %/second line
>
> one could write just
>
> * first line<br
> /> second line
>
> (a small improvment for the markdown concept). This is something to do
> with this termRegExp stuff, isn't it?
There is no need to create a different handler for <br />, which imo
is ugly in plain text.
Everything can be handled with invisible "\n" line breaks. _But_ it
causes a global change, to define lists. (All of this is imo _not_
really practical for a TiddlySpace environment. It works, but it
either makes your stuff render bad if included in other spaces. Or it
makes others stuff look ugly, if included into your space)
For this you have to take 2 formatters into account:
"list" and "lineBreak"
normally "lineBreak" deals with match:"\\n|<br ?/?>"
and list "list" termRegExp: /(\n)/mg, handles everyting between * and
the _first_ \n that is seen afterwards. It takes the whole content and
handles it over to the formatters again, where "lineBreak" would
handle "<br>".
so your example code looks like this for the formatter:
* first line<br\n
/> second line\n
Where the "backslash n" is a line break and is invisible. It will
define the "list to be stopped / ended there". You can define
"list" termRegExp: /(\n\n)/mg .. which will cause to write a list like
this:
* first line \n
second line \n
\n
the 2 last \n's will stop the list. The _problem_ here is, that if you
look at the rendered html in a "vanilla"/standard TW it will be IMO
ugly, because of the whitespace in between the list and a following
block.
And stuff produced with a vanilla TW won't work/render well with your
TW because of missing white space.
eg:
* first line<br>second line \n
some paragraph text\n
\n
====
I created a "hack" for linebreaks, to get better readability for
"palin/raw text" LineBreakHack [1]. But I disabled it in my TS,
because I like to "import" other peoples stuff and read it within my
space. But it is not readable if the plugin is activated.
You can include the space and try some tests, change
if (formatters[i].name == "list") {
merge( formatters[i], {termRegExp: /(\n{1,2})/mg});
}
to:
if (formatters[i].name == "list") {
merge( formatters[i], {termRegExp: /(\n\n)/mg}); // <-- see \n\n
}
[1] http://line-break-hack.tiddlyspace.com/#LineBreakHack
-m
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywikidev?hl=en.