Skip to content

Instantly share code, notes, and snippets.

View RyotaUshio's full-sized avatar
💭
I may be slow to respond.

Ryota Ushio RyotaUshio

💭
I may be slow to respond.
  • UTokyo / RIKEN AIP
  • Japan
  • 04:52 (UTC +09:00)
View GitHub Profile
@RyotaUshio
RyotaUshio / pin-daily-note-in-sidebar.js
Last active October 11, 2023 12:41
Obsidian QuickAdd script that opens & auto-updates today's daily note in the right sidebar.
module.exports = async (params) => {
const { app, obsidian } = params;
// Create WorkspaceLeaf (a tab in the right sidebar) which today's daily note will be opened in
const leaf = app.workspace.getRightLeaf(false);
// Open today's daily note in the leaf
await updateLeafFile(leaf, app, obsidian);
// Show the leaf (tab in sidebar)
app.workspace.revealLeaf(leaf);
@RyotaUshio
RyotaUshio / fuzzy-input-suggest.ts
Created February 11, 2024 05:30
Obsidian FuzzyInputSuggest
abstract class FuzzyInputSuggest<Item> extends AbstractInputSuggest<Ranked<Item>> {
plugin: MyPlugin;
inputEl: HTMLInputElement;
constructor(plugin: MyPlugin, inputEl: HTMLInputElement) {
super(plugin.app, inputEl);
this.inputEl = inputEl;
this.plugin = plugin;
}
@RyotaUshio
RyotaUshio / Zotero Integration.md
Last active April 23, 2024 15:33
My Template for Obsidian Zotero Integration

{% if attachments -%} PDF: {%- for attachment in attachments | filterby("title", "endswith", ".pdf")%}

  • "[[{{ attachment.title }}]]" {%- endfor %} {%- endif %} {% if accessDate -%} accessDate: {{ accessDate | format('YYYY-MM-DD') }} {%- endif %}
@RyotaUshio
RyotaUshio / obsidian-canvas-metadata.ts
Last active April 9, 2025 09:44
Trigger metadata events for Obsidian Canvas files
/**
This snippet was originally a part of PDF++ v1 (which is under development and not public yet).
https://github.com/RyotaUshio/obsidian-pdf-plus
Obsidian internally indexes Canvas files, but does not emit any events when metadata change.
Calling the `patchCanvasIndex` function allows you to listen to the `canvas-index-initialized`
and `canvas-index-changed` events.
The signatures are:
on(evt: 'canvas-index-changed', callback: (file: TFile, cache: CanvasCachedMetadata | null) => any, context?: any): EventRef;
@RyotaUshio
RyotaUshio / obsidian-debug-info.ts
Last active June 28, 2025 09:26
Recreate Obsidian's "Show debug info" command
// Originally from the PDF++ plugin (https://github.com/RyotaUshio/obsidian-pdf-plus)
/** Selected subset of the "Show debug info" command's result with some additional entries. */
export async function getObsidianDebugInfo(app: App) {
// This is an empty string if it's the default theme
const themeName = app.customCss.theme;
const themeManifest = app.customCss.themes[themeName];
const numSnippets = app.customCss.snippets.filter((snippet) => app.customCss.enabledSnippets.has(snippet)).length;
const plugins = app.plugins.plugins;