File picker for linking local files

  • This builds on top of File explorer from within Logseq
  • It is supposed to be used on the right pane, for copying links to the main pane.
  • Simple click on button Copy md link to put in the clipboard a markdown link of the form [name](<file:///path>), ready to be pasted on the main pane.



  • Follow the steps at File explorer from within Logseq
  • Optional additional style inside file custom.css:
    button.filesystem.copy-md-link {
      background: #00ff00;
  • Inside page FileSystem in Logseq, lower than the existing code-block, add the following code in a separate javascript code-block:
const LS = logseq.api
const Module = logseq.Module
const FS = Module.FileSystem
.setStatic(function appendButtonsForBlock(div, block){
    const blockId = block.uuid
    if ( div.append(
        FS.button("Read", FS.onReadClicked, blockId)
        FS.button("Copy md link", FS.onCopyPathClicked, blockId)
.setStatic(function onCopyPathClicked(blockId, e){
    const block = LS.get_block(blockId)
    fs.access(FS.fullPathOfBlock(block), (err)=>{
        if (err) return info("doesn't exist")

        const name = FS.nameOfBlock(block)
        const path = FS.fullPathOfBlock(block)
        navigator.clipboard.writeText("[" + name + "](<file:///" + path + ">)")
        Module.Msg.ofStatus("copied", "success")

const fs = FS.fs