Action
Markdown Emphasis (_)
Posted by agiletortoise,
Last update
25 days ago
UPDATES
about 1 month ago
Add configured value support to change emphasis character
Apply Markdown emphasis to selection or insert the emphasis character if no selection. By default, this action uses _
(underscore) as the emphasis character.
The action can be configured to use *
as your emphasis character.
Steps
-
configurationKey
name Emphasis Character
key markupCharacter
-
script
// Apply Markdown emphasis to selection, or insert _ if no selection let markup = "_"; if (context.configuredValues["markupCharacter"]) { markup = context.configuredValues["markupCharacter"] } const sel = editor.getSelectedText(); const [st, len] = editor.getSelectedRange(); if (!sel || sel.length == 0) { editor.setSelectedText(markup + markup); editor.setSelectedRange(st + markup.length,0); } else { editor.setSelectedText(markup + sel + markup); editor.setSelectedRange(st + len + (markup.length*2),0); }
Options
-
After Success Nothing Notification Error Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.