How do I store fields inside *.md files? As if it were a .tid file, without separating fields to the .meta file

174 views
Skip to first unread message

Shareda

unread,
Aug 4, 2021, 6:53:46 AM8/4/21
to TiddlyWiki

Hello! I am setting up my workflow using TiddlyWiki 5.1.23 on Node.js. 
I would like to store and edit all of my tiddlers within the *.md files with all their fields.

How can I switch off the generating of the separate *.meta files for MD format and store the filds the same way as they are stored in .tid files ? 

My own research is about to fail :^)

Saq Imtiaz

unread,
Aug 4, 2021, 7:10:51 AM8/4/21
to TiddlyWiki
Look at the section on "File System Extensions" at https://tiddlywiki.com/#Customising%20Tiddler%20File%20Naming

Shareda

unread,
Aug 4, 2021, 7:11:49 AM8/4/21
to TiddlyWiki
In another words I want to replace ".tid" by ".md" for the filesystem.

среда, 4 августа 2021 г. в 16:53:46 UTC+6, Shareda:

Shareda

unread,
Aug 4, 2021, 7:14:22 AM8/4/21
to TiddlyWiki
Thank you for answering! I did so, but got unwanted .meta files

среда, 4 августа 2021 г. в 17:10:51 UTC+6, saq.i...@gmail.com:

Shareda

unread,
Aug 5, 2021, 2:05:09 AM8/5/21
to TiddlyWiki
Got it! 
But to do that you have to edit boot.js

After this lines

    $tw.utils.registerFileType("text/vnd.tiddlywiki","utf8",".tid");

    $tw.utils.registerFileType("application/x-tiddler","utf8",".tid");

Add this ones

    $tw.utils.registerFileType("text/vnd.tiddlywiki","utf8",".md");

    $tw.utils.registerFileType("application/x-tiddler","utf8",".md");

And change this lines

    $tw.utils.registerFileType("text/markdown","utf8",[".md",".markdown"],{deserializerType:"text/x-markdown"});

    $tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);

to

    $tw.utils.registerFileType("text/markdown","utf8",[".mdX",".markdown"],{deserializerType:"text/x-markdown"});

    $tw.utils.registerFileType("text/x-markdown","utf8",[".mdX",".markdown"]);

среда, 4 августа 2021 г. в 17:14:22 UTC+6, Shareda:

PMario

unread,
Aug 5, 2021, 7:57:42 AM8/5/21
to TiddlyWiki
Hi Shereda,

I think we didn't have this usecase yet. ... As I understand it, you want to keep the .md file extension but use the TW .tid fields section and be able to load the .md files into TW as if they where .tid files. ... That's new!

I'm not sure if we can and if we should provide this functionality. ... Markdown editors expect a common format if they read .md files. Using TW fields at the top is not standard for markdown.

What is your reasoning behind that? What makes it impossible for you to have a .md.meta file which contains the field info?

-mario

Saq Imtiaz

unread,
Aug 5, 2021, 8:25:46 AM8/5/21
to TiddlyWiki
 
I'm not sure if we can and if we should provide this functionality. ... Markdown editors expect a common format if they read .md files. Using TW fields at the top is not standard for markdown.

Agreed. If we do add support for meta data in markdown files it would then be prudent to consider the YAML frontmatter format which is becoming quite commonplace:

Now I better duck before Jeremy throws something at me for mentioning YAML.

Jeremy Ruston

unread,
Aug 5, 2021, 8:56:28 AM8/5/21
to tiddl...@googlegroups.com
> Agreed. If we do add support for meta data in markdown files it would then be prudent to consider the YAML frontmatter format which is becoming quite commonplace:
> https://jekyllrb.com/docs/front-matter/
> https://gohugo.io/content-management/front-matter/
>
> Now I better duck before Jeremy throws something at me for mentioning YAML

I certainly would draw the line at integrating a full YAML parser, but there’s no reason why we couldn’t parse a simple subset of YAML fields from MD files.

Best wishes

Jeremy

PMario

unread,
Aug 5, 2021, 11:53:54 AM8/5/21
to TiddlyWiki
On Thursday, August 5, 2021 at 2:56:28 PM UTC+2 Jeremy Ruston wrote:
...
I certainly would draw the line at integrating a full YAML parser, but there’s no reason why we couldn’t parse a simple subset of YAML fields from MD files.

I do agree here. The only thing we would need to implement, would be to search for the --- markers, strip them out and convert the rest using the TW parser. ...

There is still the problem with the default nodejs behaviour, that it splits   type: text/markdown  files into 2 elements. We would need to change that back to write a single .md file with the "front-matter" stuff at the top.

So we will need to support 2 versions. The problem is that it seems they didn't change the file extension. So we do have no real indicator if a file contains front-matter content or not. ...

-mario

Jeremy Ruston

unread,
Aug 5, 2021, 12:08:13 PM8/5/21
to tiddl...@googlegroups.com
We actually have a similar situation with .js files. As you know, they can contain front matter like this:

/*\
title: $:/core/modules/commands/build.js
type: application/javascript
module-type: command

Command to build a build target

\*/
(function(){

But one can also include a .meta file. Any fields specified there are processed before the front matter fields, so the values there take precedence.

We should therefore be able to follow the same approach with .md files

Best wishes

Jeremy


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/11ee592e-dae3-4e9a-bd75-1b879160d110n%40googlegroups.com.

Shareda

unread,
Aug 6, 2021, 3:19:24 AM8/6/21
to TiddlyWiki
Hello! (sorry for my English) 

I have made the converter scripts for html/fb2 books that slices a book to the atomic tiddlers and maps all the keywords as links to the keywords tiddlers wich are the summary of all occurrences. So I get something like tiddlybook or hyperbook. Then I can read the book "non-linear" :)  and make any notes, attatch favmarks and so on, getting my own research and extract of the source.

Recently I saw the Obsidian Graphs. That is beautiful for me. Not useful :^) And now I am making and testing some custom integrations between TiddlyWiki on Node.js and Obsidian Markdown vault.

Yesterday I noticed that TiddlyWiki has [[text|link]] syntax, but Obsidian has [[link|text]]. Not beautiful :)   

четверг, 5 августа 2021 г. в 17:57:42 UTC+6, PMario:

Shareda

unread,
Aug 6, 2021, 3:43:14 AM8/6/21
to TiddlyWiki
2021-08-06_13-44-43.png

пятница, 6 августа 2021 г. в 13:19:24 UTC+6, Shareda:
Reply all
Reply to author
Forward
0 new messages