1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-12-22 16:08:09 +00:00

Merge pull request #20 from m-wim/master

Added new script to replace square brackets on list items with single…
This commit is contained in:
Patrizio Bekerle 2017-12-10 22:17:51 +01:00 committed by GitHub
commit 75cae46bdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import QtQml 2.0
/**
* This is an example for custom styling of html in the note preview
*/
QtObject {
/**
* This function is called when the markdown html of a note is generated
*
* It allows you to modify this html
* This is for example called before by the note preview
*
* @param {Note} note - the note object
* @param {string} html - the html that is about to being rendered
* @return {string} the modfied html or an empty string if nothing should be modified
*/
function noteToMarkdownHtmlHook(note, html) {
// see http://doc.qt.io/qt-5/richtext-html-subset.html for a list of
// supported css styles
html = html.replace(/<li>(\s*)(<p>)*(\s*)\[x\]/g, "<li style=\"list-style-type: none; margin-left: -16px;\">$1$2$3&#x2611;");
html = html.replace(/<li>(\s*)(<p>)*(\s*)\[ \]/g, "<li style=\"list-style-type: none; margin-left: -16px;\">$1$2$3&#x2610;");
return html;
}
}

View file

@ -0,0 +1,9 @@
{
"name": "Export checkboxes",
"identifier": "export-checkboxes",
"script": "export-checkboxes.qml",
"version": "0.0.1",
"minAppVersion": "17.12.0",
"authors": ["@m-wim"],
"description" : "This script changes the html output. If list items start with a check box mark the list bullet and mark is replaced with a single UTF-8 character for checked/unchecked state."
}