Integrating Obsidian

Robert writes, Had success tonight syncing a folder on my phone that obsidian writes to, to a wiki asset folder using nextcloud... So I write in obsidian and markdown files with page names show up in the asset folder.

Thinking I might do something similar to what you recommended Thompson... Collect ideas with some other tool, then migrate them into wiki. This obsidian sync thing will help with that. And if I write in a wiki style, I'm sure those MD files that collect in the asset folder can be converted into ghost pages and then forked in.

Ward replies, Are you thinking that an html script in a Frame plugin would convert those, one at a time, to ghost pages that you could choose to keep?

Would you like help getting started with that html script?

Script would have several parts. See below. Seven parts, each three or four lines. That comes to about 25 lines. Which one would you want to do first?

tips

An html script has maybe one or two important statements for each part we outline. These will be connected by ordinary statements and punctuation left as an exercise for the reader.

html <div> that will show the list of files.

<div id=result onclick=doclick(event)>working</div>

script that would do the rest.

<script type=module> import * as frame from './frame.js'

script gets the list of assets and filters only .md files.

const assets = await frame.assets()

script formats the list as <li> items that can be clicked.

window.result.innerHTML = assets.map(asset => `<li data-url="${asset.url}">${asset.file}</li>`)

script click handler reads the corresponding asset file.

const text = await fetch(event.target.dataset.url) .then(res => res.text())

script click handler formats file contents as title and story.

const title = 'New Note from Obsidian' const story = [{type:'markdown', text}]

script click handler opens the ghost page with story.

frame.open({title,story}, event.shiftKey)

The test.html script and the frame.js scripts can be stored as assets and then added to a Frame plugin near the Obsidian md files.

.

We wrap the Frame plugin's integrations with a promise-based interface and distribute them as an ES6 module along with a couple of helpers found useful. github