Transclusion in Markdown

582 views
Skip to first unread message

Martin Hähnel

unread,
Apr 14, 2018, 8:26:15 AM4/14/18
to TiddlyWiki
Hey everyone,

I'm not sure if this is even the right expression for it, but:

As far as I can see it's not possible to include another tiddler into a markdown tiddler via the transclusion syntax: 
{{MyTiddler}}

Is this correct or am I missing something?

Thanks in advance for your help.

-Martin

P.S.: Not sure if this is needed, but: TW single file version 5.1.15, on macOS 10.13.4 (High Sierra)

David A. Gershman

unread,
Apr 14, 2018, 11:30:02 AM4/14/18
to tiddlywiki
Are you sure the "MyTiddler" case and syntax is correct?  I just ran a test on my 5.1.5 and it worked fine under Linux/FF.  Also, which browser are you using?  I only have Sierra, not High Sierra, but can test on it w/FF or Safari if you'd like.
--
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 post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4e2d99f4-91dd-4605-9184-913b31c6e58a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jed Carty

unread,
Apr 14, 2018, 11:34:46 AM4/14/18
to TiddlyWiki
TiddlyWiki syntax won't work in a markdown tiddler because it doesn't use the tiddlywiki parser. So I don't think it is possible to use transclusions in a markdown tiddler.

Martin Hähnel

unread,
Apr 14, 2018, 12:22:49 PM4/14/18
to TiddlyWiki
I see. Where would one go to request such a feature? Would it be hard to change this?

Jed Carty

unread,
Apr 14, 2018, 12:43:28 PM4/14/18
to TiddlyWiki
I believe that it would be very difficult to change this. Mixing the different parser types may require rewriting both parsers.

Martin Hähnel

unread,
Apr 14, 2018, 2:12:40 PM4/14/18
to TiddlyWiki
That's a pitty. But thanks anyways!

Mat

unread,
Apr 15, 2018, 5:23:19 AM4/15/18
to TiddlyWiki
On Saturday, April 14, 2018 at 6:22:49 PM UTC+2, Martin Hähnel wrote:
I see. Where would one go to request such a feature? Would it be hard to change this?

If you really want to request it, it would be on the tw github page.

But maybe your need could be solved by multiple text areas? I belive that setting tiddler type only affects the main text area so if you include a second text area viewtemplate to the tiddler viewtemplate then this could be used for the transclusion part. A simple case would be to include this second textarea just above or below the default one.

I didn't try exactly this but I think that to achieve this, you could merely clone these tiddler

$:/core/ui/ViewTemplate/body  and  $:/core/ui/EditTemplate/body
 
and add a list-after field to them with with their respective value "$:/core/ui/...Template/body"

Of course this solution assumes you're satisified with having the transclusion part in a static position (e.g always below the markdown text) so it is a bit limited.

<:-)




@TiddlyTweeter

unread,
Apr 15, 2018, 10:03:02 AM4/15/18
to TiddlyWiki
Ciao Martin

It IS an interesting question.

Part of the issue you face is technical. It should be easier to do what you want--but it isn't--yet.

WHY? Because a parser for a mark-up system tends to NOT support anything it doesn't itself directly support. This is with good (standards) intent, but I think short-sighted on actual usage.

Personally I think MUTANT MARKUP is perfectly legitimate--meaning you write in one markup system but ALSO can include some TW markup that gets correctly rendered.

If you are tech-minded a place to start is to look at BJ's plugin for creating new Content Types ...

http://bjtools.tiddlyspot.com/#Flexitype%20Demos

... study it and you will get a lot clearer about the TW parser and how it works. Its actually very amenable to change. BJ made two Markdown parsers. You could maybe add a RULE-module to one of them?

Best wishes
Josiah

Mark S.

unread,
Apr 15, 2018, 12:35:38 PM4/15/18
to TiddlyWiki
It's lazy of me to ask, but when you use BJ's system, do you retain the ability to transclude and run other widgets? If so, then that seems the best hybrid mark-up (assuming that all that regex doesn't break down at high densities).

Thanks!
Mark

@TiddlyTweeter

unread,
Apr 15, 2018, 2:00:35 PM4/15/18
to tiddl...@googlegroups.com
Mark S.
... when you use BJ's system, do you retain the ability to transclude and run other widgets?


It depends. Basically, a big yes. The real answer is his work on Content Types is really sophisticated. Its more a suite of plugins than just one. BJ offers ways to switch on and off different existing rules, combine them with new rules and, generally, take full control of the parser.

The variant he made (largely for me & Jan last year in response to our need for Fountain screenplay markup--and you got involved in that too) that is a pure raw regex based approach, runs regex BEFORE the main parser kicks in, is amazing for what you can do in ad-hoc pragmatic conversion in an easily usable way (no JS bits to write).

The only downside with these tools I found is it took me a while to get my head round how they work. They are not that well documented. I'm sure techies would find that easier than I did though.

Best wishes
Josiah

@TiddlyTweeter

unread,
Apr 16, 2018, 6:24:23 AM4/16/18
to TiddlyWiki
Martin Hähnel wrote:
As far as I can see it's not possible to include another tiddler into a markdown tiddler via the transclusion syntax: 
{{MyTiddler}}


UPDATE: TiddlyWiki style Transclusion IS allowed in BJ's Markdown parser called "More Markdown Like" (MDL).

1 - Install http://bjtools.tiddlyspot.com/#%24%3A%2Fplugins%2Fbj%2Fflexitype

2 - Install http://bjtools.tiddlyspot.com/#%24%3A%2Fplugins%2Fbj%2Fmarkdownlike

Set the Content Type of a Markdown Tiddler to: "text/vnd.twbase;flexibility=MDL"

There is a test Tiddler for its Markdown syntax here: http://bjtools.tiddlyspot.com/#More%20Markdown%20Like

Best wishes
Josiah

Martin Hähnel

unread,
Apr 21, 2018, 6:39:23 AM4/21/18
to TiddlyWiki
Thanks for your help. I'll have to give bj's MDL parser a try, then. Although I'm a little worried: How future proof is it to use a parser like this? Will I be able to use this  in five years still? And should a hint for bj's MDL or the limitations of the standard markdown parser be included in the description on tiddlywiki.com?

P. S.: It seems with regards to adoption, that Markdown should be more of a first class citizen and be just as versatile as WikiText out of the box. Or am I looking at it too narrowly from the viewpoint of a markdown fan? Of course, this would be a topic for another thread…

BJ

unread,
Apr 21, 2018, 9:23:34 AM4/21/18
to tiddl...@googlegroups.com
Hi Martin,
note that 'MDL' is not a markdown parser, It's just changes to parts of the tiddlywiki markup to make those parts more like markdown (for use when I am entering text into github and want to copy to tiddlywiki).  It would be nice if some of the basic markup was the same, but it is not.

markdown is very limited compared with tiddlywiki - they serve different purposes. One way to think of the difference would be to split the tiddlywiki markup into parts that are just another way to do what markup does and the rest. The rest is very large.

If you want to include content from one markdown tiddler into another then this can be probably be achieve fairly easily with another 'flexitype' parser I wrote which includes transclusion and marcros into markdown:

https://web.archive.org/web/20150901053545/http://bjtools.tiddlyspot.com/#MdExtendDemoDocs

the tiddler MarkdownExample shows transclusion use and MarkdownExample2 shows use of the tabs macro

all the best
BJ
Reply all
Reply to author
Forward
0 new messages