Commit graph

33 commits

Author SHA1 Message Date
Claude
a5127727f0
Enable Back button and fix clean-URL reloads
Renderer (app/index.html):
- navigateTo now pushes a history entry for user navigations (pushState),
  while the initial load, back/forward (popstate/hashchange), and category
  re-renders still replaceState. The browser Back button now returns to the
  previous page instead of leaving the site.

Service worker (mdcms.py generator + app/service-worker.js):
- Serve the cached index.html app shell for navigation requests. Reloading a
  clean URL like /section-id previously 404'd on the static host before any
  JavaScript ran; the shell fallback lets the client-side router resolve the
  path. Also makes pretty-URL reloads work offline.

https://claude.ai/code/session_018KXUwmSNMGF2UBywTChCcS
2026-06-12 07:16:12 +00:00
Claude
df0f179004
Fix renderer XSS/routing bugs and restore CLI fetch-deps
Renderer (app/index.html):
- Guard the router so navigateTo and the hashchange/popstate handlers only
  load relative .md paths (isSafePagePath). Blocks fetching attacker-
  controlled external URLs injected via the location hash.
- Stop treating in-page heading anchors (#heading) as page files, which
  previously replaced the page with a 404.
- HTML-escape meta.title, link href/title attributes, not-found/offline
  messages, and the icon fallback img; block javascript:/data: hrefs via
  safeUrl.
- Hydrate mdcms tags nested inside tabs/accordions/callouts.
- Configure marked once instead of on every render.
- Validate stored theme value; fix text-align center; resolve per-category
  offline message after categories initialise.

CLI (mdcms.py):
- Restore CDN_DEPS, _WOFF2_URL_RE, _fetch_bunny_fonts, _patch_index_html so
  fetch-deps no longer raises NameError.
- Compare site markers against SITE_FORMAT_VERSION with zero-padded version
  comparison, removing the spurious "update available" warning on v0.6 sites.
- Bump CLI to 0.6.1.

https://claude.ai/code/session_018KXUwmSNMGF2UBywTChCcS
2026-06-12 07:07:15 +00:00
Claude
c7fde737f2
chore: bump version to 0.6.0 (7 June 2026)
Some checks failed
/ mirror (push) Has been cancelled
https://claude.ai/code/session_01Ai8xRvmrzdhuTKiRQ2fnn9
2026-06-07 18:03:09 +00:00
Claude
8e7f5d3ae9
feat: mdcms build writes mdcms.json; register accepts URLs
mdcms build now calls generate_site_manifest() at the end of every build,
writing mdcms.json to the site root. This file lists all deployable files
and empty directories, and is deployed alongside the site so any mdcms
user can register a copy of the site from its URL.

mdcms register now accepts a GitHub repo URL or plain HTTPS URL as PATH
or via --from. GitHub URLs try mdcms.json (raw content) first and fall
back to the Contents API tree-walk. Plain URLs require mdcms.json to be
present and fail with a clear error if it is not found.

- generate_site_manifest() added; called at end of run_build
- download_template(dest, source=None) dispatches on source type
- _parse_github_url() extracts owner/repo/branch/subpath from GitHub URLs
- _fetch_manifest() / _apply_manifest() handle the manifest protocol
- _download_tree_api() retained as GitHub Contents API fallback
- _http_get_github() carries Accept header for Contents API responses
- MANIFEST_FILENAME = "mdcms.json"; GITHUB_URL_RE added
- app/template-manifest.json replaced by app/mdcms.json
- register command: PATH accepts URL; --from option added

https://claude.ai/code/session_01Ai8xRvmrzdhuTKiRQ2fnn9
2026-06-07 18:00:24 +00:00
Claude
e559e67341
feat: manifest-driven template download
Replace the GitHub Contents API tree-walk with a flat manifest approach.
template-manifest.json lists every file and empty directory in the starter
template; download_template() fetches the manifest then pulls each file
directly as a raw URL, sidestepping git API rate limits and making the
template hostable from any HTTP source.

- GITHUB_CONTENTS_API / _github_get / _download_tree removed
- TEMPLATE_BASE_URL + TEMPLATE_MANIFEST constants added
- _http_get() replaces _github_get() (generic, no GitHub headers)
- download_template() accepts optional base_url for custom sources
- app/template-manifest.json added (v0.4, 35 files, 2 empty dirs)
- Generated files (manifest.json, service-worker.js, search.json)
  excluded from manifest — they belong to mdcms build output, not
  the starter template

https://claude.ai/code/session_01Ai8xRvmrzdhuTKiRQ2fnn9
2026-06-07 17:41:07 +00:00
Claude
b9410d4b88
Fix two bugs: SPA-routing page load failure and stale service worker
fetchPageFile now rejects text/html responses so servers with SPA routing
(e.g. Cloudflare Pages with /* /index.html 200) no longer trick the renderer
into treating a fallback index.html as a found markdown file. Category-variant
pages (page.current.md with no plain page.md) now fall through correctly to
their variant URL.

mdcms build now writes a self-unregistering service-worker.js when pwa: no,
evicting any stale caching worker left over from a previous pwa: yes build.
manifest.json is also removed when pwa: no.

https://claude.ai/code/session_01Xs5GyREFhjWxhS1UhW2wA8
2026-05-19 14:55:51 +00:00
Claude
431b1c054c
Fix: raise on config.yml parse errors instead of silently returning empty dict
A YAML parse error in config.yml (e.g. a stray tab character) caused
read_config to swallow the exception and return {}, disabling categories
and producing a broken nav.yml with no variants fields and wrong filenames.
read_config now raises ClickException on both OSError and YAMLError.

Documented in docs/knownbugs.md and docs/unreleased.md.

https://claude.ai/code/session_01Xs5GyREFhjWxhS1UhW2wA8
2026-05-19 14:15:38 +00:00
Claude
28b248735f
Patch <title> in index.html with sitename during build
mdcms build now writes the sitename from config.yml into the <title> tag
of index.html. WhatsApp, Slack, and other link-preview crawlers read the
static HTML without executing JavaScript, so the title must be correct in
the raw file. Previously it was blank (or "MD-CMS" in older templates).
2026-05-19 08:37:57 +00:00
Claude
11dc053118
Scope uncategorized-post fix to posts/ only
Pages without a category suffix still map to the default category.
Only posts/ files without a suffix get uncategorized: true in nav.yml
and category: null in search.json.

https://claude.ai/code/session_01EzU13EL8D5Ud2ngQUKDj9e
2026-05-19 07:00:36 +00:00
Claude
e1527d8e3b
Show category-less posts/pages in all categories
Files without a category suffix (e.g. post.md alongside post.en.md)
previously only appeared in the default category. They now appear in
every category, so untranslated content is always visible.

- mdcms.py: nav entries with a bare variant get `uncategorized: true`;
  search.json keeps `category: null` instead of mapping to default code
- index.html: pageShouldDisplay, posts filter, and category dropdown
  all treat uncategorized/null-category items as universally visible

https://claude.ai/code/session_01EzU13EL8D5Ud2ngQUKDj9e
2026-05-19 06:54:58 +00:00
Claude
7fa60aae59
Add full Apache 2.0 licence notice to all relevant files
- mdcms.py: expand abbreviated notice to full boilerplate
- app/index.html: fix version in comment header (v0.3.8 → v0.4)
- app/config.yml: add missing final two lines of notice
- app/theme.yml: add full licence notice (was missing entirely)

https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
2026-05-18 07:11:00 +00:00
Claude
6b2eb490fa
Bump to v0.4.0 — milestone release
- mdcms.py: CLI_VERSION 0.4.0, updated docstring and comment
- pyproject.toml: version 0.4.0
- app/index.html: site format marker → mdcms v0.4
- app/config.yml: site format marker → mdcms v0.4
- app/theme.yml: add site format marker mdcms v0.4

https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
2026-05-17 20:38:21 +00:00
Claude
9856a94d26
Add M favicon, fix manifest for PWA installability
- Generate 192x192 blue/white M icon as favicon.png
- manifest.json: add id field, proper icon sizes (192/512), purpose: any
- mdcms.py generate_pwa(): respect favicon config key, skip icons if
  file missing, emit id and correct sizes

https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
2026-05-17 20:33:00 +00:00
Claude
a9e48ffee4
Merge remote-tracking branch 'origin/main' into claude/pwa-phase7
# Conflicts:
#	app/pages/home.md
#	mdcms.py
#	pyproject.toml
#	test_phase.py
2026-05-17 19:23:31 +00:00
Claude
92615fad1c
v0.4 Phase 7: PWA support + bump to 0.3.8
- Add generate_pwa(): builds manifest.json (name, short_name, theme_color,
  standalone display, favicon icon) and service-worker.js with a
  cache-first strategy; cache name is versioned by a hash of the precache
  file list so new builds automatically invalidate old caches; precache
  list covers index.html, config.yml, nav.yml, search.json, theme file,
  and all pages/posts/assets
- Call generate_pwa() from run_build() when pwa: yes/true in config.yml
- index.html: add <link rel="manifest"> and SW registration script in
  <head>; both silently no-op when the generated files are absent
- index.html boot(): write offline-message from config to localStorage
  on every load so the message survives cache eviction
- index.html navigateTo(): show localStorage offline message when a page
  fetch fails instead of the generic not-found message
- Update CLAUDE.md with PWA config key reference

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 19:10:19 +00:00
Claude
81d0f2ffd0
Bump version to 0.3.8
https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
2026-05-17 19:07:22 +00:00
Claude
9b7639cc62
v0.4 Phase 6: fetch-deps command for offline/local dependency mode
- Add _http_get() general HTTP helper (SSL via certifi, 30s timeout)
- Add CDN_DEPS table: 6 jsDelivr assets (js-yaml, marked, fuse.js,
  highlight.js, 2x highlight CSS)
- Add _fetch_bunny_fonts(): reads theme.yml font-body/heading/code keys,
  fetches CSS from fonts.bunny.net, downloads woff2 files to assets/fonts/,
  rewrites CSS to use relative local paths, writes per-font CSS file
- Add _patch_index_html(): replaces CDN URLs with local vendor paths,
  injects <link data-mdcms-fonts> tags for locally downloaded fonts
- Add fetch-deps CLI command: downloads vendors, fetches fonts if theme.yml
  present, patches index.html — site makes no external network requests
- index.html loadFonts(): skip if data-mdcms-fonts link already present
  (set by patched index.html after fetch-deps)
- Update CLAUDE.md CLI command table with fetch-deps entries

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 19:06:31 +00:00
Claude
2412608c7c
v0.4 Phase 5: TOC tag + bump to 0.3.7
- Add renderTocTag(): groups visible pages by section in section sort
  order; sorts pages within each section by sort then filename; excludes
  current page, draft sections, and category-invisible pages; renders
  section headings and linked page lists; replaces the tag placeholder
- Add toc dispatch in hydrateMdcmsTags()
- Add .mdcms-toc, .mdcms-toc-section, .mdcms-toc-list CSS

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 18:49:16 +00:00
Claude
c657529303
Bump version to 0.3.6
https://claude.ai/code/session_01UP8Wo2CKPNhvvTkzX48CWF
2026-05-17 18:39:56 +00:00
Claude
8ae283fe41
v0.4 Phase 3: asset validation in mdcms build
- Add validate_assets(): scans config.yml and theme.yml recursively for
  string values starting with assets/, and all markdown files in pages/
  and posts/ via regex; deduplicates by (path, source) before checking
- Add _collect_yaml_assets() helper for recursive YAML traversal
- Call validate_assets() in run_build() after writing nav.yml and
  search.json; prints yellow warnings for each missing asset, build
  continues on all warnings

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 17:19:33 +00:00
Claude
1051a36044
Bump version to 0.3.5
https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 17:19:33 +00:00
Claude
373ec4035e
Bump version to 0.3.4
https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-17 17:19:33 +00:00
56c22f075d
Merge pull request #13 from kbenestad/claude/linux-install-docs-cwQsb
Claude/linux install docs cw qsb
2026-05-16 22:46:38 +07:00
7edc7ab339
Merge pull request #12 from kbenestad/claude/config-keys-overview-e3lj1
Claude/config keys overview e3lj1
2026-05-16 22:45:12 +07:00
Claude
546235020f
Bump version to 0.3.3
https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-16 15:35:53 +00:00
Claude
503eb3d83d
Add cache-busting timestamp to banner URL in --version
Prevents GitHub CDN from serving stale banner content.

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-16 15:28:00 +00:00
Claude
e3eb654996
Bump version to 0.3.2
https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-16 15:10:17 +00:00
Claude
b1fc97a024
Bump CLI to v0.3.1, add banner fetch to --version
- CLI_VERSION → 0.3.1, CLI_RELEASE_DATE → 10 May 2026
- Replace click.version_option with custom callback that prints version
  + release date, then fetches docs/banner/v{VERSION}.txt from GitHub
  and prints it; falls back to a "no online information" message on 404
  or network error
- Add versioning rule to CLAUDE.md

https://claude.ai/code/session_015XtsgTMi8UtmgxEgb5Qt2c
2026-05-16 15:05:34 +00:00
Claude
d595f38dfd
fix: coerce category codes to str to handle YAML-parsed integers
YAML parses bare numeric codes (e.g. `code: 01`) as int, causing
TypeError in CATEGORY_CODE_RE.match() which expects str/bytes.

https://claude.ai/code/session_01N1msEmfHK7UWa6mNS8LPGu
2026-05-10 15:53:24 +00:00
Claude
a6eb3119e0
Remove date and datetime frontmatter fields, consolidate to created
date and datetime were overlapping with created. Only created is now
read by the scanner and emitted in search.json; modified is also
included in search.json output alongside it.

https://claude.ai/code/session_013A4egzphocyto9bvZ76dxf
2026-05-09 13:37:36 +00:00
Claude
69677b31ca
Fix SSL cert verification in PyInstaller binaries via certifi
PyInstaller-bundled Python cannot find system CA certs on Linux/macOS.
Use certifi's bundled CA bundle for all GitHub API requests.

https://claude.ai/code/session_01MqEqGhP1guGx5VuFsLaws2
2026-05-08 17:05:38 +00:00
Claude
24670a66dd
Rebuild mdcms as proper CLI tool (v0.3)
- Replace interactive TUI with click-based subcommands:
  register, delete, view, build
- build accepts NAME (registry), --path, or CWD for GitHub Actions use
- Switch to PyYAML for frontmatter and nav.yml parsing
- Add pyproject.toml with click + PyYAML deps and mdcms entry point
- Add v0.3 version marker to app/config.yml and app/index.html
- Registry moves to ~/.config/mdcms/sites.json (XDG-compliant)
- Project root is now the directory containing index.html (no website/ subdir)
- register auto-downloads template from GitHub if no site found

https://claude.ai/code/session_01MqEqGhP1guGx5VuFsLaws2
2026-05-08 16:05:04 +00:00
9aa3610df4 v0.2.2 migrated to GitHub 2026-04-20 00:02:43 +07:00