Skip to content

elimelt/embed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

embed.md

A lightweight markdown rendering and embedding service. Write markdown in your browser and embed it anywhere with an iframe or direct link.

Self-Hosting Guide

Prerequisites

  • Docker (recommended)
  • Python 3.9+ (for local development)
  • SQLite3

Enabling HTTPS

Recommended: use reverse proxy like Nginx or Caddy

Nginx Example

server {
    listen 443 ssl;
    server_name your-domain.com;

    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;

    location / {
        proxy_pass http://localhost:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Local Development Setup

  1. Clone the repository:
git clone https://github.com/elimelt/embed.git
cd embed
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the development server:
uvicorn src.main:app --reload --port 8000

The service will be available at http://localhost:8000

Docker Setup

  1. Build the Docker image:
docker build -t server:embed .
  1. Run the Docker container:
docker run -p 80:80 server:embed

API Endpoints

Create Embed

POST /api/embeds
Content-Type: application/json

{
    "content": "# Your Markdown Content"
}

Get Document

GET /api/embeds/{embed_id}
Authorization: {auth_key}

Update Document

PUT /api/embeds/{embed_id}
Authorization: {auth_key}
Content-Type: application/json

{
    "content": "# Updated Content"
}

Delete Document

DELETE /api/embeds/{embed_id}
Authorization: {auth_key}

Using the Embed

Once you've created a markdown document, you can embed it in two ways:

  1. iframe Embed:
<iframe
  src="http://your-domain/embed/{uuid}"
  width="100%"
  height="500px"
  frameborder="0"
></iframe>
  1. Direct Link:
http://your-domain/view/{uuid}

Client Keyboard Shortcuts

  • ⌘ + P: Preview markdown
  • ⌘ + Enter: Save/update current document
  • ⇧ + ⌘ + Enter: Create new document
  • ⌘ + C: Copy embed code/link

License

MIT License - see LICENSE

About

embed markdown content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published