24 lines
594 B
QML
24 lines
594 B
QML
import QtQml 2.0
|
|
|
|
// Script to load an external .CSS file and apply it to the Markdown preview
|
|
|
|
QtObject {
|
|
|
|
function openFile(fileUrl){
|
|
// Load external file
|
|
var request = new XMLHttpRequest();
|
|
request.open("GET", fileUrl, false);
|
|
request.send(null);
|
|
return request.responseText;
|
|
}
|
|
|
|
function noteToMarkdownHtmlHook(note, html) {
|
|
// Pass loaded file into internal stylesheet
|
|
// We can alternately skip the previous function
|
|
// and directly add CSS here.
|
|
var stylesheet = openFile("style.css");
|
|
html = html.replace("</style>", stylesheet + "</style>");
|
|
return html;
|
|
}
|
|
}
|