@sleekcms/sync 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -326,6 +326,7 @@ Models describe the shape of your content. They're JSON-like files with unquoted
326
326
  |---|---|
327
327
  | `render(val)` | Render a block or entry through its template |
328
328
  | `marked(md)` | Convert markdown to HTML |
329
+ | `remark(md, opts?)` | Convert markdown to HTML with syntax-highlighted code blocks, math (`$…$`, `$$…$$`) and Mermaid diagrams, adding only the CSS/JS a page needs. `opts.codeTheme` picks a highlight.js theme (default `github-dark`) |
329
330
 
330
331
  **Images**
331
332
 
@@ -406,7 +407,11 @@ Models describe the shape of your content. They're JSON-like files with unquoted
406
407
  </form>
407
408
  ```
408
409
 
409
- Any form with `data-sleekcms="<name>"` captures and stores submissions in the CMS dashboard automatically.
410
+ Any form with `data-sleekcms="<name>"` captures and stores submissions in the CMS dashboard automatically. File uploads work out of the box too — add an `<input type="file">` and visitors can attach documents (PDF, Word, Excel, CSV, text) and images:
411
+
412
+ ```html
413
+ <input name="resume" type="file" accept=".pdf">
414
+ ```
410
415
 
411
416
  ---
412
417
 
package/dist/AGENT.md CHANGED
@@ -203,7 +203,7 @@ Like JSON but with **no quotes**; each value is a field type name:
203
203
  |---|---|
204
204
  | `text`, `paragraph`, `code`, `color`, `link` | String |
205
205
  | `richtext` | String of **HTML** — output with `<%- %>` |
206
- | `markdown` | String of **raw markdown** — convert with `<%- marked(item.x) %>` |
206
+ | `markdown` | String of **raw markdown** — convert with `<%- marked(item.x) %>`, or `<%- remark(item.x) %>` when it holds code blocks, math or diagrams |
207
207
  | `number` | Number |
208
208
  | `boolean` | `true` / `false` |
209
209
  | `emoji` | One emoji character string, e.g. `"😀"` (not free text) |
@@ -350,7 +350,7 @@ Frontmatter may be JSON (canonical — prefer it when generating), JSON5, or YAM
350
350
  | Tag | Purpose |
351
351
  |---|---|
352
352
  | `<%= expr %>` | Output, HTML-escaped (plain text) |
353
- | `<%- expr %>` | Output raw HTML (`render()`, `img()`, `marked()`, richtext) |
353
+ | `<%- expr %>` | Output raw HTML (`render()`, `img()`, `marked()`, `remark()`, richtext) |
354
354
  | `<% code %>` | Run JS (loops, conditionals) |
355
355
 
356
356
  ### Context variables (every view)
@@ -404,6 +404,18 @@ There is exactly **one** layout: `layouts/common.ejs`. It wraps every page autom
404
404
  |---|---|
405
405
  | `render(val, separator?)` | Render a block, entry, or array of them through its `blocks/<key>.ejs` / `entries/<key>.ejs` view. An `entries/<key>.ejs` view is only needed if you call `render()` on that entry — otherwise just use its data directly |
406
406
  | `marked(md)` | Markdown string → HTML string |
407
+ | `remark(md, opts?)` | Markdown string → HTML string, plus highlighted code blocks, math and Mermaid diagrams (below) |
408
+
409
+ Use `remark()` instead of `marked()` for docs, tutorials and technical posts. On top of `marked()` it renders fenced code blocks (```` ```js ````) with syntax highlighting, math written as `$e^{i\pi} + 1 = 0$` inline, `$$ … $$` on its own lines or a ```` ```math ```` fence (KaTeX), and ```` ```mermaid ```` fences as diagrams drawn in the visitor's browser. It injects only the CSS/JS the rendered markdown needs (KaTeX CSS, a code theme, the Mermaid runtime), so never `link()`/`script()` those libraries yourself.
410
+
411
+ - `opts.codeTheme` — a highlight.js theme name: default `github-dark`, or e.g. `github`, `atom-one-dark`, `base16/dracula`. `github-dark` suits the dark `pre` that `prose` draws; use a light theme only when the site gives `pre` a light background. One theme per page.
412
+ - A single-`$` pair is math only when it hugs its content (`$x^2$`), so prices like "$5 to $10" stay text. Escape a dollar that must stay literal as `\$`.
413
+ - Mermaid uses its light default theme. On a dark design, start each diagram with frontmatter: `---`, `config:`, ` theme: dark`, `---` on their own lines above the diagram.
414
+
415
+ ```ejs
416
+ <div class="prose prose-lg max-w-none"><%- remark(item.body) %></div>
417
+ <%- remark(item.body, { codeTheme: 'github' }) %> <!-- light code theme -->
418
+ ```
407
419
 
408
420
  ### Helpers — images & maps
409
421
 
@@ -491,6 +503,12 @@ Any `<form>` with `data-sleekcms="<hardcoded name>"` works automatically — sub
491
503
 
492
504
  The `data-sleekcms` value groups submissions by form; each input's `name` is stored as-is. Add an `<input type="datetime-local">` and the form becomes a **booking form** — see §11.
493
505
 
506
+ **File uploads** are supported out of the box — add an `<input type="file">` and visitors can attach documents (PDF, Word, Excel, CSV, text) and images (add `multiple` for several):
507
+
508
+ ```html
509
+ <input name="resume" type="file" accept=".pdf,.doc,.docx">
510
+ ```
511
+
494
512
  ## 11. Bookings
495
513
 
496
514
  Use this whenever visitors should **book or schedule** something — an appointment, a call, a demo, a consultation, a class, or a reservation ("pick a time / reserve a slot"). It fits appointment-based businesses: salon, spa, barber, dental/medical clinic, therapist, tutor, photographer, consultant, repair shop, restaurant reservations. **Only add a booking form when the business genuinely takes appointments and the user asks for it (or it is clearly core to the business) — never add one speculatively to an arbitrary site.**
@@ -655,7 +673,7 @@ No config element → all defaults. One per site: a second one is ignored with a
655
673
  3. Blocks never have content files. Block values live inline in the page/entry JSON that declares them.
656
674
  4. `file` field values are plain file names ending in a supported extension (`"brochure.pdf"`) — the CMS attaches or placeholder-creates the file server-side; never write objects or URLs.
657
675
  5. Never invent `video_id`/`embed_url` objects — render videos with `embed()` only. Videos are set via refs: `content/videos.json` handles for shared videos, and `cms:<handle>` / provider refs in `video` fields (§7); values that read back as embed URLs or objects are user uploads — leave them untouched.
658
- 6. `richtext` → `<%- item.x %>`. `markdown` → `<%- marked(item.x) %>`.
676
+ 6. `richtext` → `<%- item.x %>`. `markdown` → `<%- marked(item.x) %>`, or `<%- remark(item.x) %>` when it holds code, math or diagrams.
659
677
  7. CSS/JS via `link()`/`script()` only; `css/tailwind.css` is auto-injected — never `link()` it. When writing tailwind.css, `@import "tailwindcss";` must stay as its first statement — dropping it silently removes all Tailwind styling.
660
678
  8. Editable copy belongs in `content/`, not hard-coded in `.ejs`. Fixed micro-labels may stay in views.
661
679
  9. In page keys, `-` separates words and `_` means `/`. `_index` is the home page only; a section index page uses the plain section key.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleekcms/sync",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "Edit SleekCMS sites locally — models, content, templates, images — with live two-way sync and AI agent support.",
5
5
  "keywords": [
6
6
  "sleekcms",