About "WikiScript"; And MarkUp: Markdown is better or Wikitext is better

Said in Is it possible to trigger an action on mouse over or hover? - #7 by TW_Tones, @TW_Tones call things like <$widget /> <<macro>> \define definition as WikiScript.
And I think things like bold, iterlic, list, title, are just MarkUp, which will transform to HTML (HT Markup Language)

Markdown is mainly composed of MarkUp, but I think recently it can also use most of the WikiScript (or all of them? I haven’t use md a lot), and rendering result is exactly the same as wikitext Markup.

In WYSIWYG editor, Markup part is currently using Wikitext version. For example, when you type #, it will only regard it as a ShortCut, then autocomplete as a list, not as a title. But this is totally configurable, user can switch to MD shortcuts.
(while keep those really good part of wikitext markup shortcuts, like [img[xxx.png]], which is much better than ![](xxx.png))

What’s being saved by a WYSIWYG editor is also configurable. Currently, I save wikitext markup by default.
But considering the popularity of MD, I’m considering if we should save it as md by default?

Another question is, do you prefer md markup or wikitext markup? (While keeping using all the WikiScript unchanged)

1 Like

I suppose it would be good to have WYSIWYG for both wikitext and markdown, but wikitext is tiddlywikis default and would have a larger audience, even if there are lot of markdown users.

1 Like

The thread title states: “Markdown is better or Wikitext is better” … In my opinion there is no better. They are different

That’s right. With TW Release v5.2.6 we switched the TW markdown-plugin back to the markdown-it library. The TW plugin contains several md-plugins that should improve “quality of live” for MD based text imported to TW.

Tiddlers with the MIME-type: text/markdown and text/x-markdown are rendered with the markdown library. Then it hands the result over to the wiki-text parser, which is responsible to create the final HTML output. So it’s possible to “mix” MD MarkUp with WikiText syntax.

2 Likes

Realizing the possibility of mixing Markdown and Wikitext was an epiphany for me. IMO standardization is most important and though I don’t see it happening, replacing TW syntax for with MD for basic markup would be a huge leap toward more adoption. I try to use markdown as much as possible bc I can use it across every editor. I would have to say then that Markdown is superior bc it is ‘cross-platform’. It is however no replacement for Wikitext, or HTML for that matter, since it is extremely limited in its output.

All that being said aren’t they all just different forms of markup - ways of ‘speaking’ to the browser? Ie WikiScript, HTML, and Markdown are all different ways of displaying content in a web browser.

Perhaps, but I tend to think of HTML as the way to display the content, the various markdowns markup, macros and “TiddlyWiki script” are “shorthand” or a “meta language” for html.

We are very fortunate to be able to get one tiddler to use one markup or part there of to use another. You could even make a tool within tiddlywiki to translate between one and another if the rules are consistent and complete. The Internals plugin on tiddlywiki.com already allows us to see and copy html versions of any supported markdown.

The largest advantage that Markdown has over other markup systems is mostly irrelevant in TW.

Markdown has an extremely readable source format. This makes it easier to write; it can be written simply without any WYSIWYG controls. And you don’t have to convert it to HTML to read and understand it.

Wikitext is much, much less readable. It is of course much more powerful, but even in the subset of wikitext that overlaps with Markdown, Markdown is to my mind much easier to read, an effect magnified by the number of places on the web that allow you to create content with Markdown.

But that advantage is irrelevant in TiddlyWiki.

There is little case for reading TW source code markup. It is only there to generate HTML, add hooks for CSS, and connect to JS widgets and macros. As a creator of tiddlers, I can write with a WYSIWYG editor if I choose, and with plain markup when I’m more experienced. There’s a preview mode to see my changes live. And I will likely be adding widgets and macros, to use dynamic lists, and in general perform things that won’t be readily readable in any source format. As a reader of tiddlers, I will always want to see the generated HTML/CSS/JS app.

For reasons of familiarity and interoperability, if we could go back in time, I would definitely prefer that TW used the same markup for the simple things that Markdown supplies, *italics* rather than //italics// for instance. But TW came out around the same time that Markdown did, well before Markdown became ubiquitous. It’s hard to undo the years of differences.

2 Likes

I find // more indicative of italics than *!

3 Likes

Neither is strongly indicative. But those who’ve been using Markdown in the many places it’s accepted have probably come to a strong association. Tiddlywiki’s markup isn’t used anywhere else (that I’m aware of.)

Markdown took its cues from USENET and plain text email, where *emphasis* and **strong empasis** were a very common convention. Typographically, that’s usually italics and bold.

I can certainly see mnemonic reason to use the slash, but the point is a combination of overall readability and familiarity. However, as I was saying, I think this ship sailed long ago.

1 Like

I just thought I would add for clarity, There is tiddlywiki wiki text/markup, Mark down (available by plugin) and what I call “TiddlyWiki Script”, don’t mix it up with the other primarily short hand formatting. Although “Tiddlywiki Script” can be inside of, or contain TiddlyWiki Wiki text and in some particular ways also markdown.

  • TiddlyWiki is also so kind as to allow much of html as well
    • Primarily used for creating and structuring web pages
  • Wiki text documentation, or Wiki text Syntax, does mix Wiki text and what I refer to as TiddlyWiki Script.

I think it is as simple as saying you are looking at TiddlyWiki Script if the text you are looking at starts with or is enclosed by the following tags;

  • <$ TiddlyWiki Widgets
  • << Tiddlywiki variables, procedures, macros or functions
  • The various forms of transclusion {{
  • The <%if in
  • backtick attributes
  • The various pragma \ and arguably comments <!--

Smart design

It is and always has being wise to keep content seperate from code so unless Wikitext forms part of your code, dont mix it with user editable content, you can always use widgets, macros and transclusions to display it where needed.

Feel free to add any other indicators of TiddlyWiki Script, or comments.

Recently I always put “WikiScript” into plugins, so separation is very clear.

I think that this makes any ideas of clean separation difficult.

I’m really not sure what you mean here. I do like to separate the content, often in the form of data tiddlers, from the templates used to display them.

But the templates are usually an intermingled combination of what you’re calling wiki text and wiki script. I don’t know of any good way around that. Do you?

For example, below are a data tiddler, a small template, and a larger template that incorporates the small one. Can you suggest a way to refactor this so that we’re not intertwining the script and the markup?

Customer_12

title: Customer/12
tags: Customer
caption: Patricio Simpson
id: 12
city: Buenos Aires
country: Argentina
first-name: Patricio
last-name: Simpson
phone: (1) 135-5555

CustomerCard

title: $:/_/sql/templates/CustomerCard

<div class="customer-card">
<$link to=<<currentTiddler>> ><$text text={{{ [<currentTiddler>get[caption]] }}} /></$link><br/>
<address>
  {{!!city}}, <$link to={{!!country}}/><br />
  Phone: <a href=`tel:${ [{!!phone}search-replace:g:regexp[\D],[]] }$`>{{!!phone}}</a>
</address>
</div>

CustomerTemplate

title: $:/_/sql/templates/Customer
tags: $:/tags/ViewTemplate

<% if [<currentTiddler>tag[Customer]] %>

<$transclude tiddler="$:/_/sql/templates/CustomerCard" />

!! Orders

<ul>
<$list filter="[tag[Order]customer-id{!!id}!sort[order-date]]">
<li><$link to=<<currentTiddler>> >Order {{!!id}}</$link> (<$view field="order-date" format=date template="0MM/0DD/YYYY" />, ${{!!total-amount}})</li>
</$list>
</ul>
<% endif %>

Note the intermingling of markup (here mostly HTML, but wikitext works the same way) and scripting components such as simple transclusions, list-, view-, and text-widgets, as well as backtick substituted attribute values.

Do you find this sort of usage an anti-pattern? Do you have suggestions for cleaning it uo?

1 Like

No, it’s an anti-anti-pattern :wink:

It should be published on tw .com as THE example* of template usage. Rarely have I read an example of template usage where the data and implementation (instantiation) are clear as day.

Keep doing what you’re doing, Scott. :100:

* The current offering is dated and a little too trivial to be of use to anyone.

There is a reason, why we use wikitext in the documentation. It covers everything. – Content evolves over time. eg: A user may have a simple grocery list in a tiddler “shopping list” at the beginning. It may be as simple as.

title: Today's Shopping

* Apples
* Bred
* Butter
* Milk

A view days later the user only needs Butter and Bread, but does not want to delete Milk and Apples, because the list may be reused in a week, where we need Apples and Milk again.

So what’s the solution.

  • Create 4 tiddlers and add the tag: task: Apples, Bred, Butter and Milk
  • Also tag 2 of them: Apples and Milk done, because we do not need them today.

Reuse some elements from the TaskManagementExample like so:

title: Today's Shopping

!! List

//Drag the tasks to re-order them//

<<list-tagged-draggable tag:"task" subFilter:"!has[draft.of]!tag[done]" itemTemplate:"ShoppingListTemplate" emptyMessage:"You got it all -- Well done :)">>

!! Done

//(Listed in reverse order of completion)//

<$list filter="[!has[draft.of]tag[task]tag[done]sort[modified]]">
<div>
<$checkbox tag="done"> ~~<$link/>~~</$checkbox>
</div>
</$list>
title: ShoppingListTemplate

<$checkbox tag="done"> <$link/></$checkbox>

To prepare a new list only the “done” tags have to be reset and may be new items have to be added.


Is that WikiScript – IMO no. It’s the natural evolution of WikiText and reusing existing knowledge.

  • It starts with plain text for several tiddlers.
  • Then a natural pattern will become visible
  • Once that happens we do have the need to “automate” it, to avoid writing plain text over and over again.

TiddlyWiki WikiText is a way to solve this problem. IMO there is no need to name it wiki script and draw artificial borders. It’s all WikiText and specialisation happens naturally after some time.

The code above is very rudimentary and look like a “script”, but there is room for more abstraction like so:

title: Today's Shopping

!! List

<<shoppingList>>

!! Done

<<shoppingList done>>

IMO this does not look like a script anymore. – But now it really is a highly abstracted script. – But still it’s only WikiText.

Just some thoughts. Hope that makes sense
-m

1 Like

I didn’t understand what you mean here. Can you explain more fully how you do this?

I agree, but I’ve seen @TW_Tones making this point before, and I was really wondering about the basis for it.

A script is a set of instructions that is written for a computer to follow and perform a task. A script contains some logic.
On the other side a wikitext contains a set of formatting, they determine how content is displayed on a web page.

I may distinguish them as

  1. Wikitext script (like code or program)
  2. Wikitext markup (mostly formatting like all forms of text formatting, even using css and html widgets,…)

For example I want a UI for todo, then I can use kookma’s dynamic table macro (from the shiraz plugin) directly in my wiki. Macro call here is the WikiScript. And I may want to place the dynamic table in a new alternative layout or simply place it in the sidebar, this will involving more tiddlers, style and config tiddlers, up to 10+ tiddlers, will be a mess in the future. And search will also be interrupted by them, cause false positive.

But instead, I can put this macro call into a plugin, so there will just be 1 plugin to manage.

Usually you can use Why Gatha is a Game Changer? plugin to packup tiddlers as a plugin.

That’s interesting. I package things as plugins only to be able to share them across wikis, not to manage internal complexity. But I haven’t dealt much with layouts, internationalization, or other systems that require many coordinating tiddlers. Perhaps when I do, I will find that useful.