diff --git a/qml/panels/MarkdownView.qml b/qml/panels/MarkdownView.qml index 632e0a0..d0e8e41 100644 --- a/qml/panels/MarkdownView.qml +++ b/qml/panels/MarkdownView.qml @@ -17,7 +17,6 @@ Item { // Триггерим пересборку блоков blocksModel.clear() const blocks = mdParser.parseBlocks(markdown, vaultRoot, fileDir) - // console.log("MarkdownView update", markdown.length, blocks.length) for (let i = 0; i < blocks.length; i++) { blocksModel.append(blocks[i]) } @@ -35,30 +34,28 @@ Item { Column { id: column - width: parent.width - spacing: 8 anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right anchors.margins: 12 + spacing: 8 Repeater { model: blocksModel delegate: Item { - required property int index - required property string type - required property string html - required property string code - required property string language - required property string codeId - required property string highlighted width: parent.width height: childrenRect.height + property string blockType: model.type || "" + property string blockHtml: model.html || "" + property string blockCode: model.code || "" + property string blockLang: model.language || "text" + property string blockCodeId: model.codeId || "" + property string blockHighlighted: model.highlighted || "" // HTML block Text { - visible: type === "html" && html + visible: blockType === "html" && blockHtml width: parent.width - text: html || "" + text: blockHtml textFormat: Text.RichText wrapMode: Text.Wrap color: Theme.text @@ -68,12 +65,12 @@ Item { } // Code block - separate component CodeBlock { - visible: type === "code" + visible: blockType === "code" width: parent.width - code: code || "" - language: language || "text" - codeId: codeId || "" - highlightedText: highlighted || "" + code: blockCode + language: blockLang + codeId: blockCodeId + highlightedText: blockHighlighted onCopyRequested: (id) => { const txt = mdParser.getCodeBlock(id) if (txt.length > 0) { diff --git a/tests/mdparser_test.cpp b/tests/mdparser_test.cpp index 7473613..5db76c3 100644 --- a/tests/mdparser_test.cpp +++ b/tests/mdparser_test.cpp @@ -105,6 +105,16 @@ int main(int argc, char *argv[]) if (!probe(im, "