### Run Development Server Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/README.md Starts the development server for the digital garden. This command is typically run in the digital garden's root folder. ```bash npm run dev ``` -------------------------------- ### Less Broken Callouts Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Presents a similar structure to the previous callout example, showcasing nested and embedded content within different callout types. ```markdown --- {"dg-publish":true,"permalink":"/012-b-callouts-less-broken/"} --- > [!info] > This is a callout > [!info]- this one is closed by default > > [!success] and has a callout inside of it :o > > anything is possible :) #known-issue > [!success] this one has a friggin note embedded in it >
```js const asdf = 0 asdf++ ``` ```json { gotta: "love-dat-josn" } ``` ``` this is just text i guess ``` `bonus oneliner`
``` -------------------------------- ### Inline Code Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/0 QA hell/File with code blocks.md An example of inline code, often used for short commands or variable names within documentation. ```text bonus oneliner ``` -------------------------------- ### Path Rewriting Rules Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/Path Rewriting/Subfolder/How deep do the rewrite rules go.md Demonstrates how multiple path rewriting rules are processed. The system applies the first rule that matches the path, and subsequent rules are ignored for that path. ```text Path Rewriting: Subfolder:subfolder-rewritten Path Rewriting/Subfolder:this-will-never-hit ``` -------------------------------- ### Plain Text Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/0 QA hell/File with code blocks.md A block of text that is not recognized as code. This may represent comments or non-executable content. ```text this is just text i guess ``` -------------------------------- ### Display Header and Current File Name Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/P Plugins/PD Dataview/PD4 DataviewJs queries.md Use this snippet to render a level 2 header and display the name of the current file as a paragraph. No specific setup is required beyond having DataviewJS enabled. ```dataviewjs dv.header(2, 'Header 2'); let pg = dv.current().file.name; dv.paragraph(pg) ``` -------------------------------- ### Path Rewriting Configuration Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This example shows a path rewrite configuration where a folder is set to the root directory. This affects how files within that folder are accessed and their permalinks. ```yaml folder: ``` -------------------------------- ### Code Block with Transclusion Syntax Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/015 Code blocks.md This example shows a plain text code block containing Obsidian's transclusion syntax, '![[001 Links]]'. It serves to demonstrate how transclusions appear within code blocks. ```text This codeblock has a transclusion syntax in it. Check it out: ![[001 Links]] ``` -------------------------------- ### JSON Object Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/0 QA hell/File with code blocks.md A simple JSON object with a key-value pair. This format is commonly used for data interchange. ```json { gotta: "love-dat-josn" } ``` -------------------------------- ### Transcluding Dataview Content Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Demonstrates how Dataview content can be transcluded into another file. The example shows a Dataview-enabled file being embedded, with its content (text and links) processed as expected. ```markdown
This should say "bar" -> bar This should be a working link -> [kagi](https://kagi.com) See if those tran: [[P Plugins/PD Dataview/PD5.2 Dataview in transclusions\|PD5.2 Dataview in transclusions]]
``` -------------------------------- ### Custom Filter Transclusion Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Demonstrates a custom filter that replaces emojis. When published, this content should display many sun emojis. ```markdown
this plugin has custom filter that turns 🌞 (snow emoji) into 🌞 (THE SUN). When published, this file should have a lot of sun-emojis. 🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞
``` -------------------------------- ### Markdown with External Link Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/015 Code blocks.md A sample Markdown block that includes a definition of 'florilegium' and an external link to its Wikipedia page. This demonstrates how to embed descriptive text with citations. ```markdown In medieval Latin a florilegium (plural florilegia) was a compilation of excerpts from other writings. The word is from the Latin flos (flower) and legere (to gather): literally a gathering of flowers, or collection of fine extracts from the body of a larger work. ([via](https://en.wikipedia.org/wiki/Florilegium)) ^rwhi724352030 ``` -------------------------------- ### JavaScript Increment Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/0 QA hell/File with code blocks.md A basic JavaScript snippet demonstrating variable declaration and incrementation. Note that 'asdf++' after declaration might not behave as expected in all contexts without proper scope or function wrapping. ```javascript const asdf = 0 asdf++ ``` -------------------------------- ### Transclusion in Code Block Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/E Embeds/Transclusions/T6 transclusion inside codeblock.md This example shows a transclusion within a code block. The expected behavior is to display the literal transclusion syntax, not the transcluded content. This is a known issue. ```markdown ``` ![[005 Custom filters]] ``` ``` -------------------------------- ### Custom Emoji Filter Example Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This page demonstrates a custom filter that transforms emojis. When published, this file is expected to display numerous sun emojis. ```markdown --- {"dg-publish":true,"permalink":"/005-custom-filters/"} --- this plugin has custom filter that turns 🌞 (snow emoji) into 🌞 (THE SUN). When published, this file should have a lot of sun-emojis. 🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞🌞 ``` -------------------------------- ### Nested Transclusion Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Example of a nested transclusion, where one embedded markdown block contains another. This showcases hierarchical content embedding. ```markdown
How deep can you go? [[E Embeds/Transclusions/files/T4 Deeper|T4 Deeper]]
``` -------------------------------- ### Publishing Configuration Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter indicates that the page is intended for publishing. It also includes a note about needing a test garden token or username/repo in the `.env` file. ```yaml --- {"dg-publish":true,"permalink":"/004-publishing-this-garden/"} --- To use this test garden, add a test garden token / username / repo to `.env` (see README.md) ``` -------------------------------- ### List Files in Folder with Dataview Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/P Plugins/PD Dataview/PD1 Dataview.md Use this Dataview query to display a list of all files within the 'P Plugins' folder. Ensure the Dataview plugin is enabled. ```dataview list from "P Plugins" ``` -------------------------------- ### Initialize Excalidraw with Initial Data Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This snippet shows how to initialize Excalidraw with specific data, including elements, view settings, and other configurations. It's useful for loading predefined drawings or setting up a specific canvas state. ```javascript const InitialData = { type: "excalidraw", version: 2, source: "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.19", elements: [ { type: "text", version: 17, versionNonce: 1765827278, isDeleted: false, id: "etjlThVL", fillStyle: "hachure", strokeWidth: 1, strokeStyle: "solid", roughness: 1, opacity: 100, angle: 0, x: -87.19921875, y: 99.1875, strokeColor: "#1e1e1e", backgroundColor: "transparent", width: 120.55990600585938, height: 25, seed: 1087805266, groupIds: [], frameId: null, roundness: null, boundElements: [], updated: 1696178356575, link: null, locked: false, fontSize: 20, fontFamily: 1, text: "tis an image", rawText: "tis an image", textAlign: "left", verticalAlign: "top", containerId: null, originalText: "tis an image", lineHeight: 1.25, baseline: 18 }, { type: "text", version: 91, versionNonce: 1701927762, isDeleted: false, id: "Pu1GJH4c", fillStyle: "hachure", strokeWidth: 1, strokeStyle: "solid", roughness: 1, opacity: 100, angle: 0, x: -149.30078125, y: 152.25390625, strokeColor: "#1e1e1e", backgroundColor: "transparent", width: 310.2197265625, height: 25, seed: 1793030738, groupIds: [], frameId: null, roundness: null, boundElements: [], updated: 1696178434561, link: null, locked: false, fontSize: 20, fontFamily: 1, text: "it's not uploaded automatically", rawText: "it's not uploaded automatically", textAlign: "left", verticalAlign: "top", containerId: null, originalText: "it's not uploaded automatically", lineHeight: 1.25, baseline: 18 }, { type: "text", version: 23, versionNonce: 2137370830, isDeleted: false, id: "m40NMLqr", fillStyle: "hachure", strokeWidth: 1, strokeStyle: "solid", roughness: 1, opacity: 100, angle: 0, x: -130.09765625, y: 232.0859375, strokeColor: "#1e1e1e", backgroundColor: "transparent", width: 220.039794921875, height: 25, seed: 546057938, groupIds: [], frameId: null, roundness: null, boundElements: [], updated: 1696178440853, link: null, locked: false, fontSize: 20, fontFamily: 1, text: "this is a bug of sorts", rawText: "this is a bug of sorts", textAlign: "left", verticalAlign: "top", containerId: null, originalText: "this is a bug of sorts", lineHeight: 1.25, baseline: 18 } ], currentItemStrokeWidth: 1, currentItemStrokeStyle: "solid", currentItemRoughness: 1, currentItemOpacity: 100, currentItemFontFamily: 1, currentItemFontSize: 20, currentItemTextAlign: "left", currentItemStartArrowhead: null, currentItemEndArrowhead: "arrow", scrollX: 339, scrollY: 360.9765625, zoom: { value: 1 }, currentItemRoundness: "round", gridSize: null, gridColor: { Bold: "#C9C9C9FF", Regular: "#EDEDEDFF" }, currentStrokeOptions: null, previousGridSize: null, frameRendering: { enabled: true, clip: true, name: true, outline: true } }; InitialData.scrollToContent = true; App = () => { const e = React.useRef(null), t = React.useRef(null); const [n, i] = React.useState({ width: void 0, height: void 0 }); return ( React.useEffect(() => { i({ width: t.current.getBoundingClientRect().width, height: t.current.getBoundingClientRect().height }); const e = () => { i({ width: t.current.getBoundingClientRect().width, height: t.current.getBoundingClientRect().height }); }; return window.addEventListener("resize", e), () => window.removeEventListener("resize", e); }, [t]), React.createElement(React.Fragment, null, React.createElement("div", { className: "excalidraw-wrapper", ref: t }, React.createElement(ExcalidrawLib.Excalidraw, { ref: e, width: n.width, height: n.height, initialData: InitialData, viewModeEnabled: !0, zenModeEnabled: !0, gridModeEnabled: !1 }))) ); }; excalidrawWrapper = document.getElementById("Drawing_2023-09-23_2241.09.excalidraw.md1"); ReactDOM.render(React.createElement(App), excalidrawWrapper); })(); ``` -------------------------------- ### Configure Note for Publishing Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/README.md Add this YAML front matter to a note to designate it as the home page and mark it for publishing to your digital garden. Ensure no backticks surround the dashes. ```yaml --- dg-home: true dg-publish: true --- ``` -------------------------------- ### Basic Page with Links Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Demonstrates various types of internal links, including standard links, links to non-published pages, aliased links, and links with whitespace in their names. ```markdown --- {"dg-publish":true,"permalink":"/001-links/"} --- [[002 Hidden page|002 Hidden page]] [[003 Non published page|003 Non published page]] [[000 Home| Aliased link to home]] [[000 Home | Link containing whitespace which works in obsidian but doesn't in garden :) - yes, this could be a ticket but lo and behold]] ``` -------------------------------- ### Generate Garden Snapshot Command Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Use the 'Generate Garden Snapshot' command from the command palette to create a snapshot of your garden compilation. This process is also triggered on plugin load. ```markdown - run `Generate Garden Snapshot` from the command palette - Snapshot generation is also run on plugin load. ``` -------------------------------- ### Custom Created At Date Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter allows specifying a custom 'created' date for the file, which will be used as the createdAt date in the published garden. ```yaml --- {"dg-publish":true,"permalink":"/010-custom-created-at/","created":"2020-01-01"} --- This file should have createdAt: 2020-01-01 ``` -------------------------------- ### Specific Path Rewriting for Subfolders Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This configuration demonstrates a more specific path rewriting rule applied to a subfolder. It shows how a subfolder's path can be rewritten independently, even when a parent folder also has rewrite rules. ```yaml Path Rewriting/Subfolder2:fun-folder Path Rewriting: ``` -------------------------------- ### Custom Path Configuration Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter defines a custom path for the note, which will also be used to generate the permalink if not explicitly overridden. ```yaml --- {"dg-publish":true,"dg-path":"custom path/should also write to permalink","permalink":"/custom-path/should-also-write-to-permalink/"} --- ``` -------------------------------- ### Create a Table of Pages with 'Custom' in Name Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/P Plugins/PD Dataview/PD4 DataviewJs queries.md This query generates a table listing pages that include 'Custom' in their file name. It displays the page name and a link to the page. Ensure DataviewJS is active to use this functionality. ```dataviewjs dv.table(["name", "link"], dv.pages() .where(p => p.file.name.includes("Custom")) .map(p => [ p.file.name, p.file.link ]) ) ``` -------------------------------- ### Custom Path and Permalink Configuration Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter sets both a custom path and a distinct custom permalink. The permalink will take precedence for the URL structure. ```yaml --- {"dg-publish":true,"dg-path":"custom path/should not overwrite permalink","dg-permalink":"custom link/shouldBeDifferentToPath","permalink":"/custom link/shouldBeDifferentToPath/"} --- ``` -------------------------------- ### Local Development Environment Variables Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/README.md Configuration for local development, including GitHub repository details, Forestry.md settings, and local export path. These are typically set in a .env file. ```dotenv GITHUB_REPO= GITHUB_TOKEN= GITHUB_USERNAME= # Forestry.md settings (if you're using Forestry.md) FORESTRY_BASE_URL=https://api.forestry.md/app FORESTRY_PAGE_NAME= FORESTRY_API_KEY= # Local export (for development or self-hosting) LOCAL_GARDEN_PATH=../digitalgarden ``` -------------------------------- ### Create Dynamic Link with Dataview Field Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/P Plugins/PD Dataview/PD5.1 Dataview in transclusions.md Creates a clickable link using a Dataview field from the frontmatter. This allows for dynamic URLs or text based on note metadata. ```Dataview [kagi](`=this.url`) ``` -------------------------------- ### Jinja2 Template for Highlighting Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/015 Code blocks.md This Jinja2 template is used to format highlighted text, optionally including a location and URL, and a note. It uses conditional logic to determine what information to display. ```jinja2 {{ highlight_text }}{% if highlight_location and highlight_location_url %} ([via]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %} ^rwhi{{highlight_id}} {% if highlight_note %} {{ highlight_note }} ^rwhi{{highlight_id}}-note {% endif %} ``` -------------------------------- ### Embed Excalidraw Diagram Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This snippet demonstrates how to embed an interactive Excalidraw diagram within a Markdown file. It requires React and the Excalidraw library. The diagram's initial data and app state are configured, and it's rendered into a specified DOM element. ```javascript var InitialData = {"elements":[{"id":"sorts","lineHeight":1.25,"baseline":18},{"id":"HcrLXEvs44rS67hJzeV1v","type":"image","x":-175.90966796875,"y":-266.54738451086945,"width":356.52173913043475,"height":356.52173913043475,"angle":0,"strokeColor":"transparent","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":1,"strokeStyle":"solid","roughness":1,"opacity":100,"groupIds":[],"frameId":null,"roundness":null,"seed":1427244047,"version":24,"versionNonce":350668687,"isDeleted":false,"boundElements":null,"updated":1696271725883,"link":null,"locked":false,"status":"pending","fileId":"f5de7e7b9672dcaec815dbbc90d72635f638da20","scale":[1,1]}],"appState":{"theme":"light","viewBackgroundColor":"#ffffff","currentItemStrokeColor":"#1e1e1e","currentItemBackgroundColor":"transparent","currentItemFillStyle":"hachure","currentItemStrokeWidth":1,"currentItemStrokeStyle":"solid","currentItemRoughness":1,"currentItemOpacity":100,"currentItemFontFamily":1,"currentItemFontSize":20,"currentItemTextAlign":"left","currentItemStartArrowhead":null,"currentItemEndArrowhead":"arrow","scrollX":156.7996136209239,"scrollY":234.79127038043467,"zoom":{"value":1},"currentItemRoundness":"round","gridSize":null,"gridColor":{"Bold":"#C9C9C9FF","Regular":"#EDEDEDFF"},"currentStrokeOptions":null,"previousGridSize":null,"frameRendering":{"enabled":true,"clip":true,"name":true,"outline":true}},"files":{}};InitialData.scrollToContent=true;App=()=>{const e=React.useRef(null),t=React.useRef(null),[n,i]=React.useState({width:void 0,height:void 0});return React.useEffect(()=>{i({width:t.current.getBoundingClientRect().width,height:t.current.getBoundingClientRect().height});const e=()=>{i({width:t.current.getBoundingClientRect().width,height:t.current.getBoundingClientRect().height})};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t]),React.createElement(React.Fragment,null,React.createElement("div",{className:"excalidraw-wrapper",ref:t},React.createElement(ExcalidrawLib.Excalidraw,{ref:e,width:n.width,height:n.height,initialData:InitialData,viewModeEnabled:!0,zenModeEnabled:!0,gridModeEnabled:!1})))},excalidrawWrapper=document.getElementById("with_imageexcalidraw.md1");ReactDOM.render(React.createElement(App),excalidrawWrapper);})(); ``` -------------------------------- ### Markdown Transclusion Syntax Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Demonstrates the transclusion syntax used in Obsidian for embedding content from other markdown files. Note that some syntax like aliased links with whitespace may not work in all contexts. ```markdown This codeblock has a transclusion syntax in it. Check it out:
[[002 Hidden page]] [[003 Non published page]] [[000 Home| Aliased link to home]] [[000 Home | Link containing whitespace which works in obsidian but doesn't in garden :) - yes, this could be a ticket but lo and behold]]
``` -------------------------------- ### Custom Updated At Date Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter allows specifying a custom 'updated' date for the file, which will be used as the updatedAt date in the published garden. ```yaml --- {"dg-publish":true,"permalink":"/011-custom-updated-at/","updated":"2021-01-01"} --- This file should have updatedAt: 2021-01-01 ``` -------------------------------- ### Dataview Query in Callout Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/012 Callouts.md Embed Dataview queries directly within an info callout to display dynamic content. Ensure the Dataview plugin is enabled. ```dataview list from "012 Callouts" ``` -------------------------------- ### PNG Image Embed with Resize and Alt Text Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Markdown syntax for embedding a PNG image with specified width and alt text. The format is `![filename|alt text|width](/path/to/image.png)`. ```markdown ![travolta.png\|center\|200](/img/user/A%20Assets/travolta.png) ``` ```markdown ![travolta.png\|left](/img/user/A%20Assets/travolta.png) ``` -------------------------------- ### WEBP Image Embed Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Markdown syntax for embedding a WEBP image. The path is specified directly. ```markdown ![travolta.webp](/img/user/A%20Assets/travolta.webp) ``` -------------------------------- ### Custom Permalink Configuration Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This frontmatter specifies a custom permalink for the published page, which can differ from the file's path or name. ```yaml --- {"dg-publish":true,"dg-permalink":"my-name-is-permalink/custom-permalink","permalink":"/my-name-is-permalink/custom-permalink/"} --- [Custom permalink](https://docs.forestry.md/advanced/note-specific-settings/) ``` -------------------------------- ### PNG Image Embed Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Standard markdown syntax for embedding a PNG image. The path is specified directly. ```markdown ![travolta.png](/img/user/A%20Assets/travolta.png) ``` -------------------------------- ### Callouts with Embedded Content Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md Demonstrates various types of Obsidian callouts, including nested callouts, closed-by-default callouts, and callouts containing embedded notes with code blocks and plain text. ```markdown --- {"dg-publish":true,"permalink":"/012-callouts/"} --- #known-issue > [!info] > This is a callout > [!info]- this one is closed by default > > [!success] and has a callout inside of it :o > > anything is possible :) > [!info] This one has dataview in it... > - [[012 Callouts|012 Callouts]] > { .block-language-dataview} > [!success] this one has a friggin note embedded in it >
```js const asdf = 0 asdf++ ``` ```json { gotta: "love-dat-josn" } ``` ``` this is just text i guess ``` `bonus oneliner`
``` -------------------------------- ### Basic Arithmetic Inline Query Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/dg-testVault/P Plugins/PD Dataview/PD3 Inline JS queries.md Perform simple calculations directly in your notes using Dataview's inline query syntax. ```javascript $=2+1 ``` -------------------------------- ### Page with Only Content Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md A simple page containing only text content, with no specific frontmatter configurations for publishing or other metadata. ```markdown --- {"dg-publish":true,"permalink":"/009-comments/"} --- This is the only content on this page ``` -------------------------------- ### Embedding Excalidraw Drawing Source: https://github.com/oleeskild/obsidian-digital-garden/blob/main/src/test/snapshot/snapshot.md This snippet shows how to embed an Excalidraw drawing into an Obsidian note using provided JavaScript and CSS. It includes CDN links for React and Excalidraw, and a div to hold the drawing. ```html