GithubHelp home page GithubHelp logo

simonw / markdown-to-sqlite Goto Github PK

View Code? Open in Web Editor NEW
73.0 4.0 3.0 13 KB

CLI tool for loading markdown files into a SQLite database

License: Apache License 2.0

Python 100.00%
sqlite markdown yaml datasette-io datasette-tool

markdown-to-sqlite's Introduction

markdown-to-sqlite

PyPI Changelog Tests License

CLI tool for loading markdown files into a SQLite database.

YAML embedded in the markdown files will be used to populate additional columns.

Usage: markdown-to-sqlite [OPTIONS] DBNAME TABLE PATHS...

For example:

$ markdown-to-sqlite docs.db documents file1.md file2.md

Breaking change

Prior to version 1.0 this argument order was different - markdown files were listed before the database and table.

markdown-to-sqlite's People

Contributors

ryancheley avatar simonw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

markdown-to-sqlite's Issues

Separated columns for headers?

Thanks for this tool and datatasette wonderful ecosystem!

Sometimes we deal with collections of documents having the same structure (eg .docx) that can be transform to markdown thanks to pandoc for naming one other great tool.

Would it be possible to generate SQLite columns for headers (h1, h2...) beside paragraphs for easier comparison of recurring content?

h1 h2 h3 content
h1 title h2 subtitle h3 subsubtitle markdown paragraph

Might be out of scope though. Thx

how to use YAML for extra fields?

In the readme you mention something about embedded yaml and extra fields, but I cannot see anything documented about it. How does it work? What do I need? I would love to have more data in my database instead of having to alter the generated database directly.

I love this tool, thank you!

TypeError generated for markdown files with tables

There may be other instances where this TypeError failure occurs, but the markdown attached (its-science.md) will generate the following error:

Traceback (most recent call last):
  File "/Users/ryan/Documents/ryancheley.com/venv/bin/markdown-to-sqlite", line 8, in <module>
    sys.exit(cli())
  File "/Users/ryan/Documents/ryancheley.com/venv/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ryan/Documents/ryancheley.com/venv/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/Users/ryan/Documents/ryancheley.com/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ryan/Documents/ryancheley.com/venv/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/Users/ryan/Documents/ryancheley.com/venv/lib/python3.9/site-packages/markdown_to_sqlite/cli.py", line 27, in cli
    doc = {
TypeError: 'str' object is not a mapping

Invalid value for PATHS

I am trying to generate a database to run inside docker. However, while in my terminal this works fine

$ markdown-to-sqlite blog.db posts "./_blog/**/*.md"

when it runs inside the docker I get the following error:

Error: Invalid value for 'PATHS...': Path './_blog/**/*.md' does not exist.
Error: error building at STEP "RUN markdown-to-sqlite blog.db posts "./_blog/**/*.md"": error while running runtime: exit status 2

And I am not quite sure why it does not. I guess it has to do with the shell it runs on (on my machine I am running zsh while the docker one is just sh) but I do not know how work around it.

Any and all help will be much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.