diff --git a/manifest.json b/manifest.json index eebffa1..f80ca4b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.6.25", + "version": "1.6.26", "minAppVersion": "0.12.16", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/package.json b/package.json index a7df6ff..8915b14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-excalidraw-plugin", - "version": "1.6.26-3", + "version": "1.6.26", "description": "This is an Obsidian.md plugin that lets you view and edit Excalidraw drawings", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/EmbeddedFileLoader.ts b/src/EmbeddedFileLoader.ts index 5f0bc48..12292d6 100644 --- a/src/EmbeddedFileLoader.ts +++ b/src/EmbeddedFileLoader.ts @@ -391,7 +391,8 @@ const convertMarkdownToSVG = async ( ): Promise => { //1. //get the markdown text - let text = (await getTransclusion(linkParts, plugin.app, file)).contents; + const transclusion = await getTransclusion(linkParts, plugin.app, file); + let text = (transclusion.leadingHashes??"") + transclusion.contents; if (text === "") { text = "# Empty markdown file\nCTRL+Click here to open the file for editing in the current active pane, or CTRL+SHIFT+Click to open it in an adjacent pane."; diff --git a/src/ExcalidrawData.ts b/src/ExcalidrawData.ts index e9b2f15..ba4391f 100644 --- a/src/ExcalidrawData.ts +++ b/src/ExcalidrawData.ts @@ -1414,7 +1414,7 @@ export const getTransclusion = async ( app: App, file: TFile, charCountLimit?: number, -): Promise<{ contents: string; lineNum: number }> => { +): Promise<{ contents: string; lineNum: number; leadingHashes?: string; }> => { //file-name#^blockref //1 2 3 @@ -1473,11 +1473,16 @@ export const getTransclusion = async ( let j = i; while (jdepth) {j++}; if(j === headings.length && headings[j-1].node.depth > depth) { - return { contents: "#".repeat(depth)+" "+contents.substring(startPos).trim(), lineNum }; + return { + leadingHashes: "#".repeat(depth)+" ", + contents: contents.substring(startPos).trim(), + lineNum + }; } endPos = headings[i].node.position.start.offset - 1; return { - contents: "#".repeat(depth)+" "+contents.substring(startPos, endPos).trim(), + leadingHashes: "#".repeat(depth)+" ", + contents: contents.substring(startPos, endPos).trim(), lineNum, }; } @@ -1499,7 +1504,11 @@ export const getTransclusion = async ( } } if (startPos) { - return { contents: "#".repeat(depth)+" "+contents.substring(startPos).trim(), lineNum }; + return { + leadingHashes: "#".repeat(depth) + " ", + contents: contents.substring(startPos).trim(), + lineNum + }; } return { contents: linkParts.original.trim(), lineNum: 0 }; }; diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts index dc54b92..3a031bd 100644 --- a/src/dialogs/Messages.ts +++ b/src/dialogs/Messages.ts @@ -25,15 +25,15 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y - Dropped images and links were not selectable with the selection tool until the file was saved. This is now fixed. - Display the linked block/section on link-hover instead of the full page. [#597](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/597) - Hover preview without CTRL/CMD works again. Requires configuration in plugin settings. [#595](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/595) -- If you embed the same markdown document into a drawing multiple times, you can now display different sections of the documents in each embedded object. [#601](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/601). +- If you embed the same markdown document into a drawing multiple times, you can now display different sections of the document in each embedded object. [#601](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/601). - If you make a copy of an equation and edit this copy, the original equation will remain unchanged [#593](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/593) ## New Features -- When you drag files from dataview results onto the canvas the obsidian urls will be converted into wiki links.[#599](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/599) -- I added one more frontmatter key: ${String.fromCharCode(96)}excalidraw-linkbutton-opacity: 0.5${String.fromCharCode(96)}. This sets the opacity of the blue link-button in the top right corner of the element, overriding the respective setting in plugin settings. Valid values are numbers between 0 and 1, where 0 means the button is fully transparent. +- When you drag files from Dataview-results onto the canvas the obsidian:// urls will be converted into wiki links.[#599](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/599) +- I added one more frontmatter key: ${String.fromCharCode(96)}excalidraw-linkbutton-opacity: ${String.fromCharCode(96)} This sets the opacity of the blue link-button in the top right corner of the element, overriding the respective setting in plugin settings. Valid values are numbers between 0 and 1, where 0 means the button is fully transparent. ## New Excalidraw Automate Features -- As part of building the new ExcaliBrain plugin, I've added a number of integration features. See the GitHub [Release Notes](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.26) for details. +- As part of building the new [ExcaliBrain](https://youtu.be/O2s-h5VKCas) plugin, I've added a number of integration features. See the GitHub [Release Notes](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.26) for details. `, "1.6.25": ` ## Fixed diff --git a/versions.json b/versions.json index b1f320c..d00c87a 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "1.6.25": "0.12.16", + "1.6.26": "0.12.16", "1.4.2": "0.11.13" }