{"id":13998339,"url":"https://github.com/HananoshikaYomaru/obsidian-run","last_synced_at":"2025-07-23T06:31:11.840Z","repository":{"id":197873684,"uuid":"698305013","full_name":"HananoshikaYomaru/obsidian-run","owner":"HananoshikaYomaru","description":"Generate markdown from dataview query and javascript.","archived":false,"fork":false,"pushed_at":"2023-11-29T18:21:17.000Z","size":254,"stargazers_count":32,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-10T19:16:54.596Z","etag":null,"topics":["dataview","obsidian"],"latest_commit_sha":null,"homepage":"https://yomaru.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HananoshikaYomaru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["hananoshikayomaru"],"custom":"https://www.buymeacoffee.com/yomaru"}},"created_at":"2023-09-29T16:01:50.000Z","updated_at":"2024-08-01T23:15:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb3d8fdd-bcb1-48c1-8764-56810c60e222","html_url":"https://github.com/HananoshikaYomaru/obsidian-run","commit_stats":null,"previous_names":["hananoshikayomaru/obsidian-run"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HananoshikaYomaru%2Fobsidian-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HananoshikaYomaru%2Fobsidian-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HananoshikaYomaru%2Fobsidian-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HananoshikaYomaru%2Fobsidian-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HananoshikaYomaru","download_url":"https://codeload.github.com/HananoshikaYomaru/obsidian-run/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227245157,"owners_count":17753239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataview","obsidian"],"created_at":"2024-08-09T19:01:35.474Z","updated_at":"2024-11-30T00:31:27.931Z","avatar_url":"https://github.com/HananoshikaYomaru.png","language":"TypeScript","funding_links":["https://github.com/sponsors/hananoshikayomaru","https://www.buymeacoffee.com/yomaru"],"categories":["TypeScript"],"sub_categories":[],"readme":"# Obsidian Run\n\nGenerate markdown from dataview query and javascript.\n\n- ✅ Powerful, Dead Simple\n- ✅ Markdown based, work with every markdown editor / render\n- ✅ Works well with Dataview, Templater, Obsidian publish\n\ndemo: \u003chttps://www.youtube.com/watch?v=_UAr6e6hlVI\u0026t=71s\u003e\n\n## Installation\n\n### Plugin marketplace\n\nYou can download this from obsidian plugin store. \n\n### Manual Installation\n\n1. cd to `.obsidian/plugins`\n2. git clone this repo\n3. `cd obsidian-run \u0026\u0026 bun install \u0026\u0026 bun run build`\n4. there you go 🎉\n\n## Usage\n\n1. install this plugin and install [obsidian-custom-save](https://github.com/HananoshikaYomaru/obsidian-custom-save)\n2. add the `run: run file` command to the custom save actions\n3. define a starting tag\n\n```md\n%% run start 3+4%%\n```\n\n2. save the file\n3. you markdown will become something like this\n\n```md\n%% run start\n3+4\n%%\n7\n%% run end %%\n```\n\n### Syntax\n\nEach block of run contains three parts: starting tag (required), generated content, ending tag\n\n#### starting tag (required)\n\nyou define your expression in the starting tag. The expression will be used to calculate the content. It is the only required part for a run block.\n\n```md\n%% run start \u003cexpression\u003e %%\n```\n\nor you can also write multiple line statements. Notice that if you write in multiple line you must return a value.\n\n````md\n%% run start\n\n```ts|js\n\u003cyour expression in codeblock\u003e\n```\n\n%%\n````\n\nYou can use it with [CodeblockCustomizer](https://github.com/mugiwara85/CodeblockCustomizer), to have folding codeblock.\n\n![](https://user-images.githubusercontent.com/43137033/272329457-d278a370-63d6-4dc2-a3f4-68767745ac92.png)\n\n#### Content\n\nthe generated content\n\n#### Ending Tag\n\nending tag closes the run block.\n\n```md\n%% run end \u003cmetadata\u003e %%\n```\n\n## Options\n\n1. generate ending tag metadata: when enabled, the run block update time and error(if any) will be shown in the ending tag.\n2. ignore folders: the folder listed will be ignored by this plugin\n\n## Advanced Usage\n\n### Access file object\n\n```md\n%% run start file.basename %%\n```\n\nthe file object is the [TFile](https://docs.obsidian.md/Reference/TypeScript+API/TFile/TFile) but it is patched with `file.properties` which is the file yaml properties.\n\n### Page level variable\n\n```md\n---\nbar: \"foo\"\n---\n\n%% run start file.properties.bar %%\n```\n\n### Dataview\n\nyou can access the `dv` object if you have dataview plugin installed and enabled.\n\n````md\n%% run start\n\n```ts\nreturn dv.markdownList(dv.pages(\"#ai/image\").map((page) =\u003e page.file.link));\n```\n\n%%\n````\n\n### Templater and Reusable user scripts\n\nyou can access the `tp` object if you have templater plugin installed and enabled.\n\n\u003e Then you need to go to the setting of template and manually set a startup template. The reason of doing this is that `tp` is not initialized by default by templater and it will be undefined. Learn more and see a video: \u003chttps://github.com/HananoshikaYomaru/obsidian-run/issues/14#issuecomment-1749945619\u003e. If you don't want to set a start up template, you can manually run templater once everytime you start up obsidian. As long as templater runs once, the `tp` object will be defined.\n\n![](https://share.cleanshot.com/qwTYFCby+)\n\nTemplater allows user to have their user defined functions and scripts. To learn more, checkout \u003chttps://silentvoid13.github.io/Templater/user-functions/script-user-functions.html\u003e.\n\n### Function\n\nyou can write complicated function in starting tag codeblock\n\n### Async Function\n\nYou can do any kind of async operation in the run block. Async function is non-blocking. Results will be resolved after all sync operation are resolved. You can use the obsidian [request](https://docs.obsidian.md/Reference/TypeScript+API/request) function to fetch data.\n\n![](https://share.cleanshot.com/83hQltDB+)\n\n### Debug\n\nyou can use `console.log` in the starting tag codeblock. It will output in the developer tool.\n\n## Note\n\n1. if you want to contribute, please star and open github issue.\n2. this plugin is powerful, but it is still under early development. The syntax is subject to change but will be backward compatible as much as possible\n3. you will want to use this with [CodeblockCustomizer](https://github.com/mugiwara85/CodeblockCustomizer) to collapse your code block.\n4. you will want to save the following codeblock as template so that you can use it easily.\n\n````md\n%% run start\n\n```ts fold\nreturn;\n```\n\n%%\n````\n\n## Support\n\nIf you are enjoying this plugin then please support my work and enthusiasm by buying me a coffee on \u003chttps://www.buymeacoffee.com/yomaru\u003e.\n\n\u003ca href=\"https://www.buymeacoffee.com/yomaru\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHananoshikaYomaru%2Fobsidian-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHananoshikaYomaru%2Fobsidian-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHananoshikaYomaru%2Fobsidian-run/lists"}