Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inbox] What is a MarkdownDB? #7

Open
rufuspollock opened this issue May 2, 2023 · 0 comments
Open

[inbox] What is a MarkdownDB? #7

rufuspollock opened this issue May 2, 2023 · 0 comments

Comments

@rufuspollock
Copy link
Member

rufuspollock commented May 2, 2023

Inbox of other material

Intro

A MarkdownDB is a pattern for treating markdown files as a lightweight database along with an API for accessing them.

More specifically it is a simple way to turn a collection of markdown files and their structured data (frontmatter, tags etc) into a queryable SQL database and API. Extracted metadata includes simple things like frontmatter, tags like #mytag and much more.

MarkdownDB is especially appropriate for ...

  • Collections where the individual records include both rich text and structured metadata
  • "Micro" collections with less than 10k records

The Pattern: markdown files are records

Database consists of two things:

  • The data itself - in markdowndb these are markdown files
  • An index and API for accessing and querying those files - in markdowndb this is an sqlite database

Roughly:

  • Each markdown file corresponds to a record
  • Each directory corresponds to a table (if you want it to)

Let's have an example:

my-random-file.md
movies
  return-of-the-jedi.md
  ...

return-of-the-jedi.md

---
date: 1983
budget: 32.7
---

# Return of the Jedi

Return of the Jedi (also known as Star Wars: Episode VI – Return of the Jedi) is a 1983 American epic space opera film directed by Richard Marquand. The screenplay is by Lawrence Kasdan and George Lucas from a story by Lucas, who was also the executive producer. The sequel to Star Wars (1977) and The Empire Strikes Back (1980), it is the third installment in the original Star Wars trilogy.

Architecture

Related efforts

What's distinctive about markdowndb approach (🚩 this is where pattern and library intermingle a bit - in the most general sense markdowndb would just be a way of treating markdown files as data)

  • Do one thing only (and well): focused on building the index and providing an API
    • Does not get involved in render pipeline (as contentlayer.dev, etc
  • extract structured content beyond frontmatter
  • sql(ite) oriented (why reinvent the wheel!)
  • not tied to a particular stack (in contrast to nuxt content, astro etc)
  • open source (in constrast to tina content layer)

Inspirations etc

  • contentlayer.dev
  • https://content.nuxtjs.org
    • really nice
    • use sqlite (rather than mongo syntax)
    • tied to nuxt
    • gets involved in the rendering pipeline in a variety of ways
@rufuspollock rufuspollock transferred this issue from datopian/flowershow May 2, 2023
@rufuspollock rufuspollock changed the title What is a MarkdownDB? [inbox] What is a MarkdownDB? Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant