2017-12-10 18:11:18 +00:00
|
|
|
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
|
2018-09-04 04:19:37 +00:00
|
|
|
html = html.replace(/<li>(\s*)(<p>)*(\s*)\[[xX]\]/g, "<li style=\"list-style-type: none; margin-left: -16px;\">$1$2$3☑");
|
2017-12-10 18:11:18 +00:00
|
|
|
html = html.replace(/<li>(\s*)(<p>)*(\s*)\[ \]/g, "<li style=\"list-style-type: none; margin-left: -16px;\">$1$2$3☐");
|
|
|
|
return html;
|
|
|
|
}
|
2018-09-04 04:14:44 +00:00
|
|
|
}
|