Markdown Export 0.6.0 with toolbar button

I have updated my Markdown Export plugin with a toolbar button on tiddlers for copying, editing or downloading the tiddler’s contents as Markdown.

See cdaven's TiddlyWiki Demo

Is this what you had in mind, @TW_Tones?

5 Likes

Very good @cdaven works even without the markdown plugin, although I Imagin most people will have that installed as well.

Review comments

  • The edit as markdown is an interesting addition. Convert and edit in one click.
  • The pandoc markdown seems to work well with talk.tiddlywiki (bonus points)
  • This is a fantastic approach to handling access into the pandoc Eco system and possibly helps in a number of discussions already, some which were left without adequate solutions (super extra Bonus Points :clap: )

To Pandoc and the rest of the universe

  • Although I need to research this further, if there is, or we could, create a page to use copy to markdown, paste into pandoc, select output and copy that to any available format would be so sweet.

Suggestions (great without these applied, already)

  • This is always hard because solutions that are “next to perfect” always solicit ideas to “make it perfect” :nerd_face:

Perhaps the plugin should have a config filter so that on tiddlers, the markdown(load) button, can only display on non-system tiddlers eg [all[current]!is[system]], Using this this on a system tiddler could cause failures.

  • But typically only non-system tiddlers would be edited or converted.
  • Perhaps another filter could be used against each dropdown item, this would allow them to be selectively enabled/disabled as needed.
    • For example on a read only wiki, we may want to hide the “edit as Markdown” as we do the normal edit button, while letting “take away markdown”.
    • This could use a condition field, ask if you want the code pattern.

Command line

I tend not to use the command line so can’t easily test this.

Compound documents

Do you think it would be difficult to allow copy and download, “as markdown”, all the tiddlers in the story river,

  • This would be a Page control Button

and/or as an option generate a button that would copy/export all tiddlers in markdown, matching a give filter?

  • This would be a custom button provided a config filter. Perhaps in a macro eg; <<markdownload-button filter="[all[]tag[mydoc]]">>

Other options

  • Perhaps an option to include the tiddler title at the top of each tiddlers content when making a compound output, and the markdown to use for the headings eg; ### {{!!title}}.
  • This may seem complex at first but I think you have done most of the work, feel free to ask for help.
  • One reason for this is it will not only help listing a set of tiddlers to generate one markdown output, but also to do so when creating any valid Pandoc output we can get from there.

Finaly,
Perhaps one day we could go from Pandoc Markdown to Tiddlywiki wikitext, again opening up an opportunity to go from any Pandoc format to Tiddlywiki.

:clap: :clap: :clap: :clap: :heart: :heart: :heart:

Sooo sweeet

Pandoc is a command-line tool that depends on other tools e.g. for converting to PDF. But I’m sure there are or could be “wrappers” that run Pandoc on the backend and exposes some features as web pages or http APIs.

No, it shouldn’t be. You can already use the advanced search with a filter and then press the “export tiddlers” button and select Markdown to export multiple tiddlers.

Everything is exported to one file (I don’t think there’s any other way), and the tiddlers are separated in the Markdown code with \newpage that Pandoc interprets as a page-break.

I created a Python script to split this big downloaded file into one Markdown file per tiddler instead, which could be useful to someone: tiddlywiki-stuff/markdown-export/split-tiddlers.py at main · cdaven/tiddlywiki-stuff · GitHub

This is the actual code from the “download as Markdown button”, which could be used anywhere. You can give it a filter.

<$button class="tc-btn-invisible">
<$action-sendmessage
   $message="tm-download-file"
   $param="$:/plugins/cdaven/markdown-export/MenuItem"
   exportFilter=`[[$(currentTiddler)$]]`
   filename=`$(currentTiddler)$.md` />

<span class="tc-btn-text">Download as Markdown</span>
</$button>
1 Like

I see Perhaps then I can have an additional export on the PageControls for the story, and one in the advanced search filter tab, to export the items listed. I can share back when done.

Really cool, thanks again.

Hello cdaven,

A promising plugin.

One question: is it possible to preserve internal links?

For instance:

  • The [[TestPage]] link could be exported to
    ** [TestPage](https://MY-TIDDLYWIKI.html#TestPage)
    ** or [TestPage](./TestPage.md)

BR,

Eskha

So far, I have opted for the simple solution; to remove internal links. This is because you can think of the target of those links in several ways, and I don’t see one solution that would be good enough for most people.

  1. Should the exported Markdown files have internal links at all? What value do they provide if you export further into Word or PDF or other file formats, where the link target may not make sense?
  2. Should the exported Markdown files link back to the original TiddlyWiki? This would only be valuable if your TiddlyWiki is reachable when and where anyone reads the exported tiddlers.
  3. Should the exported Markdown files assume that the targets of internal links are also exported to Markdown files, and link to them? This would be valuable if you wanted to migrate to another software, such as Obsidian.
    1. Should we use standard Markdown links or Obsidian/Wiki-style links? This would depend on the target of your export.
    2. This also all but requires that the export actually separates tiddlers into separate Markdown files, instead of the big, combined Markdown file that the export creates today. I think it would be possible to create multiple files and zip them before download.

I think some configuration would be in order, but most people always go with the default values anyway. So I chose the simplest possible default. :slight_smile:

What do you think of the above?