DEV Community

Cover image for Turning Markdown Files into a Queryable Knowledge Graph
Javier Ramírez
Javier Ramírez

Posted on

Turning Markdown Files into a Queryable Knowledge Graph

Markdown files often contain more structure than we give them credit for.

With YAML frontmatter and consistent links, a collection of Markdown files can behave like a small knowledge graph.

Many people already use YAML frontmatter to store metadata:

---
id: mission-klendathu
type: mission
commander: [[johnny-rico]]
date: 2297-08-01
---
Enter fullscreen mode Exit fullscreen mode

Once files have consistent IDs and links between them, something interesting happens:

  • files become nodes
  • [[links]] become relations
  • the collection of files becomes a graph

Querying Markdown

One approach is to define queries directly inside Markdown files.

If you can query that graph, Markdown stops being just documents — it becomes structured data.

For example:

!view mission where commander = [[johnny-rico]]
select date, outcome
sort date desc

The query runs over all Markdown files and returns matching nodes.

In my case, I tried building a VS Code extension to explore this idea.

Live Query Results

!view queries render results as tables inside the editor.

You can edit values directly in the table, and the changes write back to the YAML frontmatter of the source file.

Live query table in VS Code with inline editing of YAML frontmatter

Why Markdown?

Yamlink

The goal is to keep everything:

  • local-first
  • Git-native
  • plain Markdown

No database, no lock-in — just structured files.


Yamlink

To explore this idea, I built a VS Code extension called Yamlink.

If you're curious:

GitHub: https://github.com/javierigaciorm/yamlink

VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=yamlink.yamlink

I'm especially interested in hearing how others are working with structured data in Markdown.

Top comments (0)