mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-11-17 23:38:07 +00:00
* Added myself to authors and incremented version number * Rewrite that uses the mark element * per request changed spelling of color, changed setting name, and re-added custom action
This commit is contained in:
parent
63edc8588a
commit
7f27b4d9a7
2 changed files with 11 additions and 11 deletions
|
@ -2,9 +2,9 @@
|
|||
"name": "Text Highlights",
|
||||
"identifier": "text-highlights",
|
||||
"script": "text-highlights.qml",
|
||||
"authors": ["@mleo2003"],
|
||||
"authors": ["@mleo2003", "@ryliejamesthomas"],
|
||||
"platforms": ["linux", "macos", "windows"],
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"minAppVersion": "17.06.2",
|
||||
"description" : "Provide a way to highlight text in markdown and render it as some other markdown viewers do. Uses ==text== syntax, and the color shown is configurable."
|
||||
}
|
||||
|
|
|
@ -2,29 +2,29 @@ import QtQml 2.0
|
|||
import QOwnNotesTypes 1.0
|
||||
|
||||
QtObject {
|
||||
property string highlightColor;
|
||||
|
||||
property string backgroundColor;
|
||||
|
||||
property variant settingsVariables: [
|
||||
{
|
||||
"identifier": "highlightColor",
|
||||
"identifier": "backgroundColor",
|
||||
"name": "Highlight Color",
|
||||
"description": "Color to highlight text as",
|
||||
"description": "Color to highlight text with (name or #hex):",
|
||||
"type": "string",
|
||||
"default": "FFFF00",
|
||||
"default": "#FFFF00",
|
||||
}
|
||||
];
|
||||
|
||||
function noteToMarkdownHtmlHook(note, html) {
|
||||
var stylesheet = ".highlighted {background-color: #" + highlightColor + ";}";
|
||||
html = html.replace(/==(.+?)==/g, "<span class='highlighted'>$1</span>");
|
||||
var stylesheet = "mark {background-color:" + backgroundColor + ";}";
|
||||
html = html.replace(/==(.+?)==/g, "<mark>$1</mark>");
|
||||
html = html.replace("</style>", stylesheet + "</style>");
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
script.registerCustomAction("addHighlights", "Add Highlight Marks", "Add Highlights", "text-wrap");
|
||||
}
|
||||
|
||||
|
||||
function customActionInvoked(identifier) {
|
||||
switch (identifier) {
|
||||
case "addHighlights":
|
||||
|
|
Loading…
Reference in a new issue