lukesmurray / linked-notes-vscode

vscode extension for taken Zettelkasten inspired markdown notes.
https://marketplace.visualstudio.com/items?itemName=lukesmurray.linked-notes-vscode
0 stars 0 forks source link

moving forward #58

Open lukesmurray opened 4 years ago

lukesmurray commented 4 years ago

I am quite happy with the tool at the moment but there are some small things I want to fix before making the tool open source.

Titles

Both Pandoc and Hugo tend to prefer the title in the frontmatter of the markdown document instead of the first header. A title in the frontmatter should have all the same affordances as a title in the markdown. The title should support rename, and be renamed when references to the document are renamed.

Front Matter

Add support for autocomplete of fields in front matter based on previous fields. Single fields should autocomplete with single fields (i.e. draft: true/false), array fields should autocomplete each item as a single field. So

tags:
  - |autocomplete here|

Default Content

I would like to provide hooks for various pieces of default content.

  1. Default new note content
  2. Default wikilink to link content. For example on netlify folder paths auto resolve to index.html. So if there is a file posts/index.html I want the link to resolve to posts. In Hugo we need shortcodes to resolve links correctly. So we would resolve to {{< rel ref "posts" >}}. This may need to be a javascript callback, but a snippet could be easier

VSNotes has good examples of this.

Publishing

At the moment I am publishing using my notes repo. The notes repo does not support tags or higher level organization. It is quite simple though.

I would like to support publishing with hugo eventually. But I really like pandoc. I put together an example of using the two together based on the information in this pull request. The benefit of publishing with hugo is the reloads are insanely quick compared to what I'm currently doing which is rebuilding everything on changes.

  1. Create a file root/hugo
#!/bin/bash
PANDOC_ORIGINAL=$(which pandoc)
export PANDOC_ORIGINAL

# Overrides pandoc.
PATH=$PWD/bin:$PATH

hugo "$@"
  1. Create a file root/bin/pandoc
#!/bin/bash
$PANDOC_ORIGINAL \
    --data-dir="metadata" \
    --defaults="html" \
    "$@"
  1. Copy the Metadata folder from the notes repo to /root/ and /static/

Basically everything should work now out of the box.

When running hugo use ./hugo to use the overridden version of hugo.

Caveats: the front matter is not passed to pandoc. In order to pass front matter you need to duplicate the front matter. The second front matter is passed to pandoc.

---
date: 2020-08-12T10:55:43-04:00
draft: true
title: My Second Post
---

---
toc: true
title: My Second Post
---