expose api for markdown
492
A lightweight Flask-based Markdown API server that:
.md files in a directoryindex.json for static sitesgit clone https://github.com/yourname/markdown-connector.git
cd markdown-connector
.md files under the markdown/ foldermkdir markdown
cp your_posts/*.md markdown/
version: "3"
services:
flask-app:
container_name: markdown-connector
build: .
ports:
- "1313:5000"
volumes:
- ./markdown:/app/markdown
- ./static:/app/markdown/static
restart: always
docker-compose up --build
.
โโโ app.py # Flask app with Swagger
โโโ requirements.txt
โโโ Dockerfile
โโโ start.sh
โโโ markdown/ # โ Your .md files go here
โโโ static/ # โ index.json will be generated here
โโโ docker-compose.yml
| Endpoint | Method | Description |
|---|---|---|
/ | GET | Health check |
/posts/ | GET | List all markdown files |
/posts/<filename> | GET | Get raw .md content |
/api/posts | GET | Get index.json metadata |
/api/refresh | GET | Rebuild index (optional ?dryrun=true) |
/index.json | GET | Alias for /api/posts |
/apidocs/ | GET | Swagger UI |
index.json Output{
"title": "My First Post",
"summary": "",
"tags": ["notes"],
"category": "blog",
"created": "2025-03-27T14:00:00",
"url": "/posts/blog/first-post.md"
}
Auto-generated docs available at:
๐http://localhost:1313/apidocs/
index.json is auto-generated at server startup.md files are served as raw markdown from /posts/flask
markdown
python-frontmatter
flasgger
MIT License. Fork & use freely. Contributions welcome!
Content type
Image
Digest
sha256:e358b3de6โฆ
Size
55.5 MB
Last updated
over 1 year ago
docker pull cloudsmithy/flask-markdown-connector