From 675ca16fa9e17ee5ac3d439d7114d2e821dea9e3 Mon Sep 17 00:00:00 2001 From: Verity <113909005+uthvah@users.noreply.github.com> Date: Sun, 14 Jun 2026 16:32:22 +0100 Subject: [PATCH] fix: resolve Obsidian scorecard warnings and readable-line-width padding bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace deprecated builtin-modules with node:module built-in - Pin monkey-around to exact version 3.0.0 - Upgrade esbuild 0.17.3 → 0.28.1 (fixes high-severity CVE) - Commit package-lock.json for reproducible builds - Add CONTRIBUTING.md and GitHub Actions release workflow with artifact attestation - Fix #ccc shorthand hex in print styles - Neutralize Obsidian's readable-line-width per-line margin-inline inside sync embeds Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/release.yml | 49 +++ CONTRIBUTING.md | 26 ++ esbuild.config.mjs | 2 +- main.js | 105 +++--- package-lock.json | 627 ++++++++++++++++++++++++++++++++++ package.json | 13 +- styles.css | 20 +- 7 files changed, 765 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 CONTRIBUTING.md create mode 100644 package-lock.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a08eced --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +on: + push: + tags: + - "*" + +permissions: + contents: write + id-token: write + attestations: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Attest main.js + uses: actions/attest-build-provenance@v1 + with: + subject-path: main.js + + - name: Attest manifest.json + uses: actions/attest-build-provenance@v1 + with: + subject-path: manifest.json + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + tag="${GITHUB_REF#refs/tags/}" + gh release create "$tag" \ + --title "$tag" \ + --generate-notes \ + main.js manifest.json styles.css diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b632674 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to Sync Embeds + +Thanks for your interest in contributing! + +## Reporting bugs & feature requests + +Open a [GitHub Issue](https://github.com/uthvah/sync-embeds/issues) before writing any code. Include steps to reproduce for bugs, or a clear use-case for feature requests. + +## Pull requests + +1. Fork the repo and create a branch from `main`. +2. Install dependencies: `npm install` +3. Run the dev build (watches for changes): `npm run dev` +4. Make your changes in `src/`. +5. Test in an Obsidian vault by symlinking or copying the plugin folder. +6. Open a PR — link the relevant issue if one exists. + +## Code style + +- Plain JavaScript (no TypeScript required for small fixes). +- Keep changes focused; one concern per PR. +- Avoid adding new `!important` declarations to `styles.css` unless overriding Obsidian host styles that cannot be targeted with specificity alone. + +## License + +By contributing, you agree your code will be released under the [MIT License](LICENSE). diff --git a/esbuild.config.mjs b/esbuild.config.mjs index a783e27..561b12d 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,6 +1,6 @@ import esbuild from "esbuild"; import process from "process"; -import builtins from "builtin-modules"; +import { builtinModules as builtins } from "node:module"; const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD diff --git a/main.js b/main.js index d0b8015..0869324 100644 --- a/main.js +++ b/main.js @@ -5,7 +5,11 @@ if you want to view the source, please visit the github repository of this plugi var __getOwnPropNames = Object.getOwnPropertyNames; var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + try { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + } catch (e) { + throw mod = 0, e; + } }; // node_modules/monkey-around/dist/index.cjs @@ -153,8 +157,7 @@ var require_viewport_controller = __commonJS({ } const keydownHandler = (event) => { var _a; - if (!embedData.viewportActive || !embedData.sectionInfo) - return; + if (!embedData.viewportActive || !embedData.sectionInfo) return; const { startLine, endLine } = embedData.sectionInfo; const cursor = editor.getCursor(); const selection = editor.getSelection(); @@ -208,10 +211,8 @@ var require_viewport_controller = __commonJS({ return; } const inputHandler = (event) => { - if (event.inputType !== "insertText" && event.inputType !== "insertFromPaste") - return; - if (event.data !== "#") - return; + if (event.inputType !== "insertText" && event.inputType !== "insertFromPaste") return; + if (event.data !== "#") return; const cursor = editor.getCursor(); const line = editor.getLine(cursor.line); const beforeHash = line.substring(0, cursor.ch - 1); @@ -240,16 +241,14 @@ Use: ${availableLevels.join(", ")}`, 5e3); const pasteHandler = (event) => { var _a; const clipboardData = (_a = event.clipboardData) == null ? void 0 : _a.getData("text"); - if (!clipboardData) - return; + if (!clipboardData) return; const cursor = editor.getCursor(); if (cursor.line > embedData.sectionInfo.startLine && cursor.line < embedData.sectionInfo.endLine) { const lines = clipboardData.split("\n"); let hasInvalidHeaders = false; const adjustedLines = lines.map((line) => { const match = line.match(/^(#{1,6})\s+(.*)$/); - if (!match) - return line; + if (!match) return line; const [, hashes, content] = match; if (hashes.length <= headerLevel) { hasInvalidHeaders = true; @@ -280,8 +279,7 @@ Use: ${availableLevels.join(", ")}`, 5e3); let isProgrammaticUpdate = false; const enforceCursorBounds = () => { var _a; - if (isProgrammaticUpdate || !embedData.viewportActive || !embedData.sectionInfo) - return; + if (isProgrammaticUpdate || !embedData.viewportActive || !embedData.sectionInfo) return; const { startLine, endLine } = embedData.sectionInfo; const cursor = editor.getCursor(); if (cursor.line <= startLine) { @@ -327,8 +325,7 @@ Use: ${availableLevels.join(", ")}`, 5e3); const cmScroller = view.containerEl.querySelector(".cm-scroller"); if (cmScroller) { const preventScroll = (e) => { - if (!embedData.viewportActive) - return; + if (!embedData.viewportActive) return; const scrollTop = cmScroller.scrollTop; const lineHeight = editor.defaultTextHeight || 20; const firstVisibleLine = Math.floor(scrollTop / lineHeight); @@ -352,8 +349,7 @@ Use: ${availableLevels.join(", ")}`, 5e3); } } updateViewportImmediately(embedData) { - if (!embedData.viewportActive) - return; + if (!embedData.viewportActive) return; const currentContent = embedData.editor.getValue(); const newSectionInfo = this.findSectionBounds(currentContent, embedData.section); if (newSectionInfo.startLine !== -1) { @@ -541,8 +537,7 @@ var require_dynamic_paths = __commonJS({ } } isValidMomentFormat(format) { - if (!format || format.trim() === "") - return false; + if (!format || format.trim() === "") return false; const validTokens = /[YMDdHhmsSaAZzX]/; return validTokens.test(format); } @@ -567,24 +562,19 @@ var require_embed_manager = __commonJS({ } cleanup() { this.activeEmbeds.forEach((embedData) => { - if (embedData.component) - embedData.component.unload(); - if (embedData.leaf) - embedData.leaf.detach(); + if (embedData.component) embedData.component.unload(); + if (embedData.leaf) embedData.leaf.detach(); }); this.activeEmbeds.clear(); - if (this.dynamicPaths) - this.dynamicPaths.cleanup(); + if (this.dynamicPaths) this.dynamicPaths.cleanup(); } getEmbedFromElement(element) { - if (!element) - return null; + if (!element) return null; let current = element; while (current && current !== document.body) { if (current.classList && current.classList.contains("sync-embed")) { const embedData = this.embedRegistry.get(current); - if (embedData) - return embedData; + if (embedData) return embedData; } current = current.parentElement; } @@ -619,12 +609,9 @@ var require_embed_manager = __commonJS({ pairs.forEach((pair) => { const [key, value] = pair.split(":").map((s) => s.trim()); if (key && value !== void 0) { - if (value === "true") - options[key] = true; - else if (value === "false") - options[key] = false; - else - options[key] = value; + if (value === "true") options[key] = true; + else if (value === "false") options[key] = false; + else options[key] = value; } }); line = line.replace(/\{[^}]+\}\]\]$/, "]]"); @@ -636,8 +623,7 @@ var require_embed_manager = __commonJS({ try { const { line: cleanedLine, options } = this.parseEmbedOptions(embedLine); const match = cleanedLine.match(/!\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/); - if (!match) - return; + if (!match) return; let linkText = match[1]; let displayAlias = (_a = match[2]) == null ? void 0 : _a.trim(); const hasDynamicPattern = /\{\{(date|time|title)/.test(linkText); @@ -652,15 +638,13 @@ var require_embed_manager = __commonJS({ resolvedText = this.dynamicPaths.resolve(linkText, ctx); this.dynamicPaths.pathCache.set(cacheKey, { value: resolvedText, timestamp: now }); } - if (!displayAlias) - displayAlias = linkText; + if (!displayAlias) displayAlias = linkText; linkText = resolvedText; } const linkPath = linkText.split("|")[0].trim(); let notePath = linkPath.split("#")[0]; const section = linkPath.includes("#") ? linkPath.substring(linkPath.indexOf("#") + 1) : null; - if (!notePath) - notePath = ctx.sourcePath; + if (!notePath) notePath = ctx.sourcePath; const file = this.plugin.app.metadataCache.getFirstLinkpathDest(notePath, ctx.sourcePath); if (!file) { this.renderError(container, `Note not found: ${notePath}`, addGap); @@ -671,8 +655,7 @@ var require_embed_manager = __commonJS({ return; } const embedContainer = container.createDiv("sync-embed"); - if (addGap) - embedContainer.addClass("sync-embed-gap"); + if (addGap) embedContainer.addClass("sync-embed-gap"); embedContainer.addClass("sync-embed-loading"); if (Object.keys(options).length > 0) { embedContainer.dataset.customOptions = JSON.stringify(options); @@ -681,8 +664,7 @@ var require_embed_manager = __commonJS({ const placeholder = embedContainer.createDiv("sync-embed-placeholder"); placeholder.setText(`Loading ${placeholderText}...`); const renderAsCallout = options.callout !== void 0 ? options.callout : this.plugin.settings.renderAsCallout; - if (renderAsCallout) - embedContainer.addClass("is-callout-style"); + if (renderAsCallout) embedContainer.addClass("is-callout-style"); const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { @@ -729,8 +711,7 @@ var require_embed_manager = __commonJS({ if (((_a = this.manager.plugin.currentFocusedEmbed) == null ? void 0 : _a.containerEl) === this.embedData.containerEl) { this.manager.plugin.currentFocusedEmbed = null; } - if (this.embedData.leaf) - this.embedData.leaf.detach(); + if (this.embedData.leaf) this.embedData.leaf.detach(); } }(this, embedData)); await leaf.openFile(file, { state: { mode: "source" } }); @@ -744,12 +725,9 @@ var require_embed_manager = __commonJS({ embedData.editor = view.editor; this.embedRegistry.set(embedContainer, embedData); this.activeEmbeds.add(embedData); - if (customOptions.height) - embedContainer.style.setProperty("--sync-embed-height", customOptions.height); - if (customOptions.maxHeight) - embedContainer.style.setProperty("--sync-max-height", customOptions.maxHeight); - if (customOptions.collapse === true) - embedContainer.addClass("is-collapsed"); + if (customOptions.height) embedContainer.style.setProperty("--sync-embed-height", customOptions.height); + if (customOptions.maxHeight) embedContainer.style.setProperty("--sync-max-height", customOptions.maxHeight); + if (customOptions.collapse === true) embedContainer.addClass("is-collapsed"); const renderAsCallout = customOptions.callout !== void 0 ? customOptions.callout : this.plugin.settings.renderAsCallout; const headerTitle = alias || (section ? `${file.basename} > ${section}` : file.basename); if (section) { @@ -789,13 +767,10 @@ var require_embed_manager = __commonJS({ requestAnimationFrame(() => { setTimeout(() => { const titleEl = view.containerEl.querySelector(".inline-title"); - if (titleEl) - titleEl.style.display = "none"; + if (titleEl) titleEl.style.display = "none"; const viewContent = view.containerEl.querySelector(".view-content"); - if (!viewContent) - return; - if (view.containerEl.querySelector(".sync-embed-header")) - return; + if (!viewContent) return; + if (view.containerEl.querySelector(".sync-embed-header")) return; const headerUI = document.createElement("div"); headerUI.className = "sync-embed-header"; if (renderAsCallout) { @@ -809,8 +784,7 @@ var require_embed_manager = __commonJS({ attr: { "href": linkPath, "data-href": linkPath } }); headerUI.addEventListener("click", (e) => { - if (e.target.closest("a")) - return; + if (e.target.closest("a")) return; e.stopPropagation(); e.preventDefault(); containerEl.classList.toggle("is-collapsed"); @@ -839,8 +813,7 @@ var require_embed_manager = __commonJS({ requestAnimationFrame(() => { setTimeout(() => { const propertiesEl = view.containerEl.querySelector(".metadata-container"); - if (!propertiesEl) - return; + if (!propertiesEl) return; const heading = propertiesEl.querySelector(".metadata-properties-heading"); if (heading && !propertiesEl.classList.contains("is-collapsed")) { heading.click(); @@ -850,8 +823,7 @@ var require_embed_manager = __commonJS({ } renderError(container, message, addGap) { const errorDiv = container.createDiv("sync-embed-error"); - if (addGap) - errorDiv.addClass("sync-embed-gap"); + if (addGap) errorDiv.addClass("sync-embed-gap"); errorDiv.setText(message); } }; @@ -1467,8 +1439,7 @@ var require_settings = __commonJS({ return "custom"; } validateCSSValue(value) { - if (!value || value.trim() === "") - return false; + if (!value || value.trim() === "") return false; const validPattern = /^(auto|none|\d+(\.\d+)?(px|em|rem|vh|vw|%))$/; const isValid = validPattern.test(value.trim()); if (!isValid) { diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..291d05d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,627 @@ +{ + "name": "obsidian-sync-embeds", + "version": "2.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "obsidian-sync-embeds", + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "monkey-around": "3.0.0" + }, + "devDependencies": { + "@types/node": "^16.11.6", + "esbuild": "^0.28.1", + "obsidian": "latest" + } + }, + "node_modules/@codemirror/state": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.0.tgz", + "integrity": "sha512-MwBHVK60IiIHDcoMet78lxt6iw5gJOGSbNbOIVBHWVXIH4/Nq1+GQgLLGgI1KlnN86WDXsPudVaqYHKBIx7Eyw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.38.6", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.6.tgz", + "integrity": "sha512-qiS0z1bKs5WOvHIAC0Cybmv4AJSkAXgX5aD6Mqd2epSLlVJsQl8NG23jCVouIgkh4All/mrbdsf2UOLFnJw0tw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@codemirror/state": "^6.5.0", + "crelt": "^1.0.6", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/codemirror": { + "version": "5.60.8", + "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.8.tgz", + "integrity": "sha512-VjFgDF/eB+Aklcy15TtOTLQeMjTo07k7KAjql8OK5Dirr7a6sJY4T1uVBDuTVG9VEmn1uUsohOpYnVfgC6/jyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/tern": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "16.18.126", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", + "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tern": { + "version": "0.23.9", + "resolved": "https://registry.npmjs.org/@types/tern/-/tern-0.23.9.tgz", + "integrity": "sha512-ypzHFE/wBzh+BlH6rrBgS5I/Z7RD21pGhZ2rltb/+ZrVM1awdZwjx7hE5XfuYgHWk9uvV5HLZN3SloevCAp3Bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/monkey-around": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/monkey-around/-/monkey-around-3.0.0.tgz", + "integrity": "sha512-jL6uY2lEAoaHxZep1cNRkCZjoIWY4g5VYCjriEWmcyHU7w8NU1+JH57xE251UVTohK0lCxMjv0ZV4ByDLIXEpw==", + "license": "ISC" + }, + "node_modules/obsidian": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.13.1.tgz", + "integrity": "sha512-qtTEA2pmhJzhuhJqzbBFRYhpIOqvW+krDYjtFynv66KbxBbumHBlsJfWw3I4jtnK/6fZwbQhCrmmDdRwXmX56w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/codemirror": "5.60.8", + "moment": "2.29.4" + }, + "peerDependencies": { + "@codemirror/state": "6.5.0", + "@codemirror/view": "6.38.6" + } + }, + "node_modules/style-mod": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz", + "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "dev": true, + "license": "MIT", + "peer": true + } + } +} diff --git a/package.json b/package.json index 1a49241..e01433b 100644 --- a/package.json +++ b/package.json @@ -7,16 +7,19 @@ "dev": "node esbuild.config.mjs", "build": "NODE_ENV=production node esbuild.config.mjs" }, - "keywords": ["obsidian", "plugin", "embeds"], + "keywords": [ + "obsidian", + "plugin", + "embeds" + ], "author": "uthvah", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", - "builtin-modules": "^3.3.0", - "esbuild": "0.17.3", + "esbuild": "^0.28.1", "obsidian": "latest" }, "dependencies": { - "monkey-around": "^3.0.0" + "monkey-around": "3.0.0" } -} \ No newline at end of file +} diff --git a/styles.css b/styles.css index a8af741..919254b 100644 --- a/styles.css +++ b/styles.css @@ -162,13 +162,18 @@ background-color: transparent !important; /* padding-top: 12px !important; */ padding-bottom: 12px !important; - padding-left: 16px !important; + padding-left: 16px !important; padding-right: 16px !important; + max-width: none !important; + margin-left: 0 !important; + margin-right: 0 !important; } /* Applying general padding to the container keeps both line numbers and content vertically aligned */ .sync-embed .cm-contentContainer { padding-top: 12px !important; + padding-left: 0 !important; + padding-right: 0 !important; } .sync-embed .markdown-source-view.mod-cm6 .cm-editor { @@ -176,8 +181,15 @@ } .sync-embed .cm-sizer { - padding-inline-start: 0 !important; - padding-inline-end: 0 !important; + padding: 0 !important; + max-width: none !important; +} + +/* Neutralize readable-line-width margin applied per-line by Obsidian */ +.sync-embed .markdown-source-view.mod-cm6 .cm-contentContainer > .cm-content > div.cm-line { + margin-inline: 0 !important; + max-width: none !important; + width: auto !important; } /* === HIDE NATIVE INLINE TITLE COMPLETELY === */ @@ -440,7 +452,7 @@ body.sync-embeds-no-focus-highlight .sync-embed:focus-within { /* === PRINT === */ @media print { .sync-container { - border: 1px solid #ccc; + border: 1px solid #cccccc; page-break-inside: avoid; }