From 3434884ea46349f32c8c42362c191dbf79c29180 Mon Sep 17 00:00:00 2001 From: Leilei332 Date: Tue, 10 Sep 2024 18:13:00 +0800 Subject: [PATCH] Add a settings page for markdown plugin (#8585) * Add a settings page for markdown plugin * Add link to $:/config/markdown/renderWikiText * Place "Quotes replacement" settings after "Typographer" * Add link to plugin itself & remove transclusion in config tab The transclusion to $:/plugins/tiddlywiki/markdown/settings in config tab is removed to avoid confusion * Add settings tab in plugin info --- plugins/tiddlywiki/markdown/config.tid | 10 ---------- plugins/tiddlywiki/markdown/plugin.info | 2 +- plugins/tiddlywiki/markdown/settings.tid | 19 +++++++++++++++++++ .../tiddlywiki/markdown/settings/breaks.tid | 9 +++++++++ .../tiddlywiki/markdown/settings/linkify.tid | 9 +++++++++ .../tiddlywiki/markdown/settings/quotes.tid | 8 ++++++++ .../markdown/settings/renderWikiText.tid | 9 +++++++++ .../settings/renderWikiTextPragma.tid | 7 +++++++ .../markdown/settings/typographer.tid | 9 +++++++++ 9 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 plugins/tiddlywiki/markdown/settings.tid create mode 100644 plugins/tiddlywiki/markdown/settings/breaks.tid create mode 100644 plugins/tiddlywiki/markdown/settings/linkify.tid create mode 100644 plugins/tiddlywiki/markdown/settings/quotes.tid create mode 100644 plugins/tiddlywiki/markdown/settings/renderWikiText.tid create mode 100644 plugins/tiddlywiki/markdown/settings/renderWikiTextPragma.tid create mode 100644 plugins/tiddlywiki/markdown/settings/typographer.tid diff --git a/plugins/tiddlywiki/markdown/config.tid b/plugins/tiddlywiki/markdown/config.tid index c3fb14c0d..1438d3fa6 100755 --- a/plugins/tiddlywiki/markdown/config.tid +++ b/plugins/tiddlywiki/markdown/config.tid @@ -2,16 +2,6 @@ title: $:/plugins/tiddlywiki/markdown/config ! Plugin Configuration -|!Config |!Default |!Description | -|[[breaks|$:/config/markdown/breaks]]|`false`|markdown-it library config: Convert '\n' in paragraphs into `
` | -|[[linkify|$:/config/markdown/linkify]]|`false`|markdown-it library config: Autoconvert URL-like text to links | -|[[renderWikiText|$:/config/markdown/renderWikiText]]|`true`|After Markdown is parsed, should any text elements be handed off to the ~WikiText parser for further processing? | -|[[renderWikiTextPragma|$:/config/markdown/renderWikiTextPragma]]|<$view tiddler="$:/plugins/tiddlywiki/markdown" subtiddler="$:/config/markdown/renderWikiTextPragma" mode="inline"/>|When handing off to the ~WikiText parser, what parser rules should it follow? | -|[[typographer|$:/config/markdown/typographer]]|`false`|markdown-it library config: Enable some language-neutral replacement + quotes beautification | -|[[quotes|$:/config/markdown/quotes]]|`“”‘’`|markdown-it library config: Double + single quotes replacement pairs, when `typographer` is enabled | - -''IMPORTANT:'' You must reload your wiki for changes to take effect. -

~WikiText Pragma

The value of [[renderWikiTextPragma|$:/config/markdown/renderWikiTextPragma]] has been carefully tuned to properly integrate markdown with ~TiddlyWiki. Changing this setting may produce unexpected results, but the inclusion of the following parser rules should be fine: diff --git a/plugins/tiddlywiki/markdown/plugin.info b/plugins/tiddlywiki/markdown/plugin.info index cf5ecea3a..1288ad068 100755 --- a/plugins/tiddlywiki/markdown/plugin.info +++ b/plugins/tiddlywiki/markdown/plugin.info @@ -2,6 +2,6 @@ "title": "$:/plugins/tiddlywiki/markdown", "name": "Markdown", "description": "Markdown parser based on markdown-it", - "list": "readme config syntax license", + "list": "readme config settings syntax license", "stability": "STABILITY_2_STABLE" } diff --git a/plugins/tiddlywiki/markdown/settings.tid b/plugins/tiddlywiki/markdown/settings.tid new file mode 100644 index 000000000..54207fa10 --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings.tid @@ -0,0 +1,19 @@ +title: $:/plugins/tiddlywiki/markdown/settings +tags: $:/tags/ControlPanel/SettingsTab +caption: Markdown + +These settings let you customise the behaviour of Markdown. See [[plugin|$:/plugins/tiddlywiki/markdown]] readme and config tab for more information. + +''IMPORTANT:'' You must reload your wiki for changes to take effect. + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Settings/Markdown]]"> + +
> > + +!!.tc-control-panel-accent <$link><$transclude field="caption"/> + +<$transclude/> + +
+ + \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/breaks.tid b/plugins/tiddlywiki/markdown/settings/breaks.tid new file mode 100644 index 000000000..95ebc47a8 --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/breaks.tid @@ -0,0 +1,9 @@ +title: $:/plugins/tiddlywiki/markdown/settings/breaks +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Breaks + +markdown-it library config: Convert `\n` in paragraphs into `
` + +<$checkbox tiddler="$:/config/markdown/breaks" field="text" checked="true" unchecked="false"> + [[Breaks|$:/config/markdown/breaks]] + \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/linkify.tid b/plugins/tiddlywiki/markdown/settings/linkify.tid new file mode 100644 index 000000000..c43928ccf --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/linkify.tid @@ -0,0 +1,9 @@ +title: $:/plugins/tiddlywiki/markdown/settings/linkify +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Linkify + +markdown-it library config: Autoconvert URL-like text to links + +<$checkbox tiddler="$:/config/markdown/linkify" field="text" checked="true" unchecked="false"> + [[Linkify|$:/config/markdown/linkify]] + \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/quotes.tid b/plugins/tiddlywiki/markdown/settings/quotes.tid new file mode 100644 index 000000000..b4247ede6 --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/quotes.tid @@ -0,0 +1,8 @@ +title: $:/plugins/tiddlywiki/markdown/settings/quotes +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Quotes replacement +list-after: $:/plugins/tiddlywiki/markdown/settings/typographer + +markdown-it library config: Double + single quotes replacement pairs, when [[typographer|$:/config/markdown/typographer]] is enabled. + +|[[Quotes replacement|$:/config/markdown/quotes]]|<$edit-text tiddler="$:/config/markdown/quotes" tag="input"/> | \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/renderWikiText.tid b/plugins/tiddlywiki/markdown/settings/renderWikiText.tid new file mode 100644 index 000000000..9b2073c10 --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/renderWikiText.tid @@ -0,0 +1,9 @@ +title: $:/plugins/tiddlywiki/markdown/settings/renderWikiText +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Enable WikiText + +After Markdown is parsed, should any text elements be handed off to the ~WikiText parser for further processing? + +<$checkbox tiddler="$:/config/markdown/renderWikiText" field="text" checked="true" unchecked="false"> + [[Enable WikiText|$:/config/markdown/renderWikiText]] + \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/renderWikiTextPragma.tid b/plugins/tiddlywiki/markdown/settings/renderWikiTextPragma.tid new file mode 100644 index 000000000..12b4ceefb --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/renderWikiTextPragma.tid @@ -0,0 +1,7 @@ +title: $:/plugins/tiddlywiki/markdown/settings/renderWikiTextPragma +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Enabled WikiText parser rules + +When handing off to the ~WikiText parser, what parser rules should it follow? + +|[[Enabled WikiText parser rules|$:/config/markdown/renderWikiTextPragma]]|<$edit tiddler="$:/config/markdown/renderWikiTextPragma" class="tc-edit-texteditor" autoHeight="yes"/> | \ No newline at end of file diff --git a/plugins/tiddlywiki/markdown/settings/typographer.tid b/plugins/tiddlywiki/markdown/settings/typographer.tid new file mode 100644 index 000000000..5b9153dae --- /dev/null +++ b/plugins/tiddlywiki/markdown/settings/typographer.tid @@ -0,0 +1,9 @@ +title: $:/plugins/tiddlywiki/markdown/settings/typographer +tags: $:/tags/ControlPanel/Settings/Markdown +caption: Typographer + +markdown-it library config: Enable some language-neutral replacement + quotes beautification + +<$checkbox tiddler="$:/config/markdown/typographer" field="text" checked="true" unchecked="false"> + [[Typographer|$:/config/markdown/typographer]] + \ No newline at end of file