import QtQuick 2.0 import Sailfish.Silica 1.0 Page { id: page property var note property var markdown: [ { regex: new RegExp(/(^#\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^##\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^###\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^####\s)(.*)$/gm), replace: '

$2

' }, { regex: new RegExp(/(^#####\s)(.*)$/gm), replace: '
$2
' }, { regex: new RegExp(/(^######\s)(.*)$/gm), replace: '
$2
' }, { regex: new RegExp(/(^-\s)(.*)$/gm), replace: '' }, { regex: new RegExp(/(^\d{1,}.\s)(.*)$/gm), replace: '
  1. $2
' } ] SilicaFlickable { id: flickable anchors.fill: parent contentHeight: column.height PullDownMenu { quickSelect: true MenuItem { text: qsTr("Edit") onClicked: pageStack.push(Qt.resolvedUrl("EditPage.qml"), { note: note } ) } } Column { id: column width: parent.width PageHeader { title: note.title } LinkedLabel { x: Theme.horizontalPageMargin width: parent.width - 2*x textFormat: Text.StyledText text: note.content Component.onCompleted: { for (var i=0; i < markdown.length; i++) { text = text.replace(markdown[i].regex, markdown[i].replace) } console.log(text) } } } VerticalScrollDecorator {} } }