/vite-plugin-md-graph

Vite plugin for loading markdown files in bulk.

Primary LanguageTypeScript

md-graph Vite plugin

This was my attempt at a Vite plugin that would be able to load Markdown files individually, but also in bulk. The bulk loading offered to reduce/summarize all notes into single data structure.

My motivation behind this plugin was to support visualizations of notes, but I decided for a simple 2-step approach: pre-processing the markdown files first to jsons and then simply importing them.

Pros and cons of this approach

Pros

  • unopinionated approach -- any framework, just vite
  • conceptually simple -- just say what you want to import, we'll process it for you
  • no added build step

Cons

  • a lot of complexity in one place -- there is a lot to manage, all while being restricted by Vite
  • some processing cannot be done separately for each file -- difficult to ensure consistency between the imported files
  • ultimatelly was only a step toward my ultimate goal
  • there are some problems still to be solved
    • watching for changes
    • ensuring consistency (a note A references B, but B gets deleted)

Overall I don't think this is necessarily a bad idea. There is just few reasons to overcome the complexity of this approach and prefer it to the simpler 2-step approach.