diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index e9bec7682..205db4c91 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -277,6 +277,8 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) { } // Get the current value of the tiddler we're editing var tiddler = this.wiki.getTiddler(targetTitle); + var defaultType = this.wiki.getTiddlerText("$:/config/DefaultMissingType", "").trim(); + var defaultFields = { type: defaultType }; // Save the initial value of the draft tiddler draftTitle = this.generateDraftTitle(targetTitle); var draftTiddler = new $tw.Tiddler({ @@ -288,7 +290,8 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) { "draft.title": targetTitle, "draft.of": targetTitle }, - this.wiki.getModificationFields() + this.wiki.getModificationFields(), + tiddler === null || tiddler === undefined ? defaultFields : {} ); this.wiki.addTiddler(draftTiddler); return draftTiddler; diff --git a/editions/markdowndemo/tiddlers/DefaultMissingType.tid b/editions/markdowndemo/tiddlers/DefaultMissingType.tid new file mode 100644 index 000000000..2f725cd4c --- /dev/null +++ b/editions/markdowndemo/tiddlers/DefaultMissingType.tid @@ -0,0 +1,3 @@ +title: $:/config/DefaultMissingType + +text/markdown diff --git a/editions/markdowndemo/tiddlers/HelloThere.tid b/editions/markdowndemo/tiddlers/HelloThere.tid index c536d83ee..32e134299 100644 --- a/editions/markdowndemo/tiddlers/HelloThere.tid +++ b/editions/markdowndemo/tiddlers/HelloThere.tid @@ -6,4 +6,10 @@ This is a demo of TiddlyWiki5 incorporating a plugin for parsing tiddlers writte To add the plugin to your own TiddlyWiki5, just drag this link to the browser window: -[[$:/plugins/tiddlywiki/markdown]] \ No newline at end of file +[[$:/plugins/tiddlywiki/markdown]] + +! Overridden Defaults + +This demo overrides the default value for tiddlers created from missing tiddler +links so that Markdown is the default rather than WikiText. See +the [[$:/config/DefaultMissingType]] tiddler for the modification. diff --git a/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting DefaultMissingType.tid b/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting DefaultMissingType.tid new file mode 100644 index 000000000..41532e083 --- /dev/null +++ b/editions/tw5.com/tiddlers/hiddensettings/Hidden Setting DefaultMissingType.tid @@ -0,0 +1,7 @@ +tags: [[Hidden Settings]] +title: Hidden Setting: Default-Missing Type +type: text/vnd.tiddlywiki + +By default new tiddlers are created with a blank content type. + +The hidden setting in $:/config/DefaultMissingType can be set to another content type which is used by default for new tiddlers created by clicking on a missing link (for example, `text/markdown` to default to Markdown for missing tiddlers). If no value is provided, the content type will be blank and WikiText will be used. diff --git a/plugins/tiddlywiki/markdown/readme.tid b/plugins/tiddlywiki/markdown/readme.tid index f924ddec8..c097db8dc 100755 --- a/plugins/tiddlywiki/markdown/readme.tid +++ b/plugins/tiddlywiki/markdown/readme.tid @@ -98,4 +98,22 @@ When [[typographer|$:/config/markdown/typographer]] is enabled, markdown-it will ,, → , -- → – --- → — -``` \ No newline at end of file +``` + +! Making Markdown the Default in TiddlyWiki + +!! Modifying Existing Actions + +Adding `type="text/markdown"` to the actions of the following buttons will +override the default behavior. + +* New Journal - $:/core/ui/Actions/new-journal +* New Tiddler Here - $:/core/ui/Buttons/new-here +* New Tiddler - $:/core/ui/Actions/new-tiddler + +!! Using Markdown for Missing Links + +By default, missing tiddlers are created with a blank content type, which +implies WikiText. Setting [[$:/config/DefaultMissingType]] to `text/markdown` +will make it so that tiddlers created from a missing tiddler link will be in +Markdown rather than in WikiText.