diff --git a/site/content/assets/blog/markdowbdb-launch-site-example.png b/site/content/assets/blog/markdowbdb-launch-site-example.png new file mode 100644 index 00000000..cf1900aa Binary files /dev/null and b/site/content/assets/blog/markdowbdb-launch-site-example.png differ diff --git a/site/content/blog/markdowndb-launch.md b/site/content/blog/markdowndb-launch.md index a96b233b..9b8e37bf 100644 --- a/site/content/blog/markdowndb-launch.md +++ b/site/content/blog/markdowndb-launch.md @@ -1,20 +1,21 @@ --- -title: Announcing the official launch of MarkdownDB! 🚀 -description: We're excited to announce the official launch of MarkdownDB, an open library to transform markdown content into SQLite database. And now, it has a dedicated website at markdowndb.com +title: 'Announcing MarkdownDB: an open source tool to create an SQL API to your markdown files! 🚀' +description: MarkdownDB - an open source library to transform markdown content into sql-queryable data. Build rich markdown-powered sites easily and reliably. New dedicated website at markdowndb.com date: 2023-10-11 authors: ['Ola Rubaj'] -filetype: 'blog' --- Hello, dear readers! -We're excited to announce the official launch of MarkdownDB, an open library to transform markdown content into SQLite database. And now, it has a dedicated website! +We're excited to announce the official launch of MarkdownDB, an open source library to transform markdown content into sql-queryable data. Get a rich SQL API to your markdown files in seconds and build rich markdown-powered sites easily and reliably. -Visit https://markdowndb.com/ +We've also created a new dedicated website: + +https://markdowndb.com/ ## 🔍 What is MarkdownDB? -MarkdownDB transforms your Markdown content into a queryable, lightweight SQLite database. Imagine being able to treat your collection of markdown files like entries in a database! Ever thought about fetching documents with specific tags or created in the past week? Or, say, pulling up all tasks across documents marked with the "⏭️" emoji? With MarkdownDB, all of this (and more) is not just possible, but also a breeze. +MarkdownDB transforms your Markdown content into a queryable, lightweight SQLite database. Imagine being able to treat your collection of markdown files like entries in a database! Ever thought about fetching documents with specific tags or created in the past week? Or, say, pulling up all tasks across documents marked with the "⏭️" emoji? With MarkdownDB, all of this (and more) is not just possible, but a breeze. ## 🌟 Features @@ -22,18 +23,126 @@ MarkdownDB transforms your Markdown content into a queryable, lightweight SQLite - Lightweight and fast indexing 1000s of files in seconds. - Open source and extensible via plugin system. -## 🚀 Quick start +## 🚀 How it works -1. Start with a collection of markdown files. These could be your blog posts, project docs, or any other type of content. Each file can be enhanced with a YAML frontmatter to include metadata. +### You have a folder of markdown content -2. Index your files with MarkdownDB. Use our npm `mddb` package to index your Markdown files into an SQLite database. +For example, your blog posts. Each file can have a YAML frontmatter header with metadata like title, date, tags, etc. -3. And that's it! Now you're all set to query your files with SQL or integrate with the MarkdownDB Node.js API for a more customized experience. +```md +--- +title: My first blog post +date: 2021-01-01 +tags: [a, b, c] +author: John Doe +--- + +# My first blog post + +This is my first blog post. +I'm using MarkdownDB to manage my blog posts. +``` + +### Index the files with MarkdownDB + +Use the npm `mddb` package to index Markdown files into an SQLite database. This will create a `markdown.db` file in the current directory. + +```bash +# npx mddb +npx mddb ./blog +``` + +### Query your files with SQL... + +E.g. get all the files with with tag `a`. + +```sql +SELECT files.* +FROM files +INNER JOIN file_tags ON files._id = file_tags.file +WHERE file_tags.tag = 'a' +``` + +### ...or using MarkdownDB Node.js API in a framework of your choice! + +Use our Node API to query your data for your blog, wiki, docs, digital garden, or anything you want! + +E.g. here is an example of a Next.js page: + +```js +// @/pages/blog/index.js +import React from 'react'; +import clientPromise from '@/lib/mddb.mjs'; + +export default function Blog({ blogs }) { + return ( +
+

Blog

+ +
+ ); +} + +export const getStaticProps = async () => { + const mddb = await clientPromise; + // get all files that are not marked as draft in the frontmatter + const blogFiles = await mddb.getFiles({ + frontmatter: { + draft: false, + }, + }); + + const blogsList = blogFiles.map(({ metadata, url_path }) => ({ + ...metadata, + url_path, + })); + + return { + props: { + blogs: blogsList, + }, + }; +}; +``` + +And the imported library with MarkdownDB database connection: + +```js +// @/lib/mddb.mjs +import { MarkdownDB } from 'mddb'; + +const dbPath = 'markdown.db'; + +const client = new MarkdownDB({ + client: 'sqlite3', + connection: { + filename: dbPath, + }, +}); + +const clientPromise = client.init(); + +export default clientPromise; +``` + +### Build your blog, wiki, docs, digital garden, or anything you want + +And share it with the world! + +![[markdowbdb-launch-site-example.png]] 👉 [Read the full tutorial](https://markdowndb.com/blog/basic-tutorial) --- -Explore the world of MarkdownDB on [our new official website](https://markdowndb.com/) and support us on [GitHub](https://github.com/datopian/markdowndb). +Find out more on our new official website: https://markdowndb.com/ + +Check out the source on GitHub: https://github.com/datopian/markdowndb — Ola Rubaj, Developer at Datopian