Metadata-Version: 2.4
Name: larzmark
Version: 0.1.0
Summary: Markdown to HTML plus an SEO-first static site generator (Open Graph, JSON-LD, sitemap). Zero dependencies.
Author: larz-scripter
License: MIT
Project-URL: Homepage, https://github.com/larz-scripter/larzmark
Project-URL: Repository, https://github.com/larz-scripter/larzmark
Project-URL: Documentation, https://github.com/larz-scripter/larzmark#readme
Project-URL: Issues, https://github.com/larz-scripter/larzmark/issues
Keywords: markdown,html,static-site-generator,ssg,seo,open-graph,json-ld,sitemap,blog,docs,zero-dependency,pure-python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Topic :: Text Processing :: Markup :: HTML
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# larzmark

**Markdown → HTML, and an SEO-first static site generator. Zero dependencies.**

Turn a Markdown string into clean HTML, or turn a folder of Markdown files into a
complete static website — every page wrapped with a full set of SEO tags (title,
description, canonical, Open Graph, Twitter, JSON-LD) and a `sitemap.xml`, out of
the box.

```python
import larzmark

# one string
larzmark.render("# Hello\n\nSome **bold** text.")     # -> "<h1 id=...>Hello</h1>..."

# a whole site
larzmark.build_site("content/", "public/",
                    base_url="https://example.com",
                    site_name="My Site")
```

## Why

- **Zero dependencies.** Pure standard library — no `markdown`, no `jinja2`, no
  build toolchain. One import, and it runs anywhere Python does.
- **SEO is the default, not an add-on.** Every generated page ships with the meta
  tags search engines and social cards actually read, plus JSON-LD structured
  data and a sitemap — driven straight from front matter.
- **Real Markdown.** Headings (with anchor ids), emphasis, code spans and fenced
  blocks, links, images, blockquotes, nested ordered/unordered lists, horizontal
  rules, and GFM pipe tables.
- **Safe output.** Text is HTML-escaped and URLs are sanitised, so untrusted
  Markdown can't inject tags or break out of an `href`.
- **Composable.** Pair it with [larzchart](https://github.com/larz-scripter/larzchart)
  to embed inline SVG charts, or generate pages from data in
  [larzdb](https://github.com/larz-scripter/larzdb).

## Install

```bash
pip install larzmark
```

## Front matter drives the SEO

```markdown
---
title: My Post
description: A short, search-friendly summary.
type: article
date: 2026-07-26
author: Ada Lovelace
image: https://example.com/cover.png
---

# My Post

The first paragraph becomes the meta description if you don't set one.
```

`build_site` reads that and emits:

```html
<title>My Post</title>
<meta name="description" content="A short, search-friendly summary.">
<link rel="canonical" href="https://example.com/blog/my-post.html">
<meta property="og:title" content="My Post">
<meta property="og:type" content="article">
<meta name="twitter:card" content="summary_large_image">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"Article",...}</script>
```

## API

| | |
|---|---|
| `render(md)` | Markdown string → HTML fragment |
| `parse_front_matter(text)` | `(meta_dict, body)` |
| `Document.parse(text)` | parsed doc with `.title`, `.description`, `.html`, `.meta` |
| `seo_head(title, description, canonical=, image=, ...)` | just the `<head>` SEO tags |
| `render_page(doc, canonical=, template=)` | one full HTML page |
| `build_site(src, out, base_url=, site_name=, template=)` | build a whole site + sitemap |

Bring your own template (a `str.format` string with `{head}`, `{content}`,
`{lang}`) or use the built-in responsive, dark-mode-aware default.

## Supported Markdown

Headings `#`–`######` · **bold** · *italic* · `code` · fenced code blocks with
language classes · [links](#) · ![images](#) · > blockquotes · nested `-`/`1.`
lists · `---` rules · GFM pipe tables (with `:--:` alignment) ·
~~strikethrough~~ · `<https://autolinks>`.

It's a practical, readable subset — the Markdown people actually write for docs,
blogs, and READMEs — not a spec-exhaustive parser.

## Tests

```bash
python -m unittest discover -s tests -v      # 31 tests, zero deps
```

## The Larz stack

Pure-Python, zero-dependency building blocks:

- **[larz](https://github.com/larz-scripter/larz)** — money-native web framework
- **[larzchain](https://github.com/larz-scripter/larzchain)** — from-scratch PoW blockchain
- **[larzmoney](https://github.com/larz-scripter/larzmoney)** — exact, penny-perfect money
- **[larzcrypt](https://github.com/larz-scripter/larzcrypt)** — pure-Python cryptography toolkit
- **[larzdb](https://github.com/larz-scripter/larzdb)** — crash-safe embedded database
- **[larzagent](https://github.com/larz-scripter/larzagent)** — zero-dep AI agent framework
- **[larzchart](https://github.com/larz-scripter/larzchart)** — data to inline SVG charts
- **larzmark** — this library

## License

MIT © larz-scripter
