inlaycms 0.3.0 → 0.4.1
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 +11 -7
- package/assets/admin/admin.css +1 -1
- package/assets/admin/editor.js +37 -37
- package/dist/core/fields/widgets.js +2 -1
- package/dist/core/media/library.js +2 -2
- package/dist/core/messages/en.d.ts +3 -1
- package/dist/core/messages/en.js +3 -1
- package/dist/core/richtext/html.js +2 -0
- package/dist/core/richtext/inline.d.ts +1 -1
- package/dist/core/richtext/inline.js +2 -2
- package/dist/core/richtext/markdown.d.ts +4 -1
- package/dist/core/richtext/markdown.js +50 -8
- package/dist/core/richtext/schema.d.ts +8 -3
- package/dist/core/richtext/schema.js +10 -3
- package/dist/host/app.js +2 -1
- package/dist/host/drain.d.ts +12 -0
- package/dist/host/drain.js +34 -0
- package/dist/host/worker.js +6 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -241,7 +241,7 @@ import { afterAll, beforeAll, expect, it } from 'vitest'
|
|
|
241
241
|
|
|
242
242
|
let site: TestSite
|
|
243
243
|
beforeAll(async () => {
|
|
244
|
-
site = await createTestSite({ config: './inlay.config.ts', baseUrl: 'https://
|
|
244
|
+
site = await createTestSite({ config: './inlay.config.ts', baseUrl: 'https://example.com' })
|
|
245
245
|
})
|
|
246
246
|
afterAll(() => site.close())
|
|
247
247
|
|
|
@@ -272,6 +272,10 @@ The JSON-LD check applies to sites that add JSON-LD through `ctx.head`; Inlay do
|
|
|
272
272
|
|
|
273
273
|
What a site's fields can hold, beyond plain text and the basics of `f.richText`.
|
|
274
274
|
|
|
275
|
+
### Inline code
|
|
276
|
+
|
|
277
|
+
Rich text and inline text hold inline code, on by default: a command, a file name or a placeholder, shown in a monospace font. In Markdown it is text between backticks (`` Run `npm test` first ``); a span holding a backtick is fenced with more of them (``` ``a`b`` ```). It renders as `<code>`. Code can go inside a link (``[`npm test`](/docs/testing)``) and in table cells, but it can't be bold or italic: Markdown that puts code inside bold or italic text is refused with the line it is on. Code blocks aren't supported. To leave code out of a field, list its `features` without `'code'`.
|
|
278
|
+
|
|
275
279
|
### Tables
|
|
276
280
|
|
|
277
281
|
Rich text holds tables, on by default. In Markdown (what assistants send and get back, and what shipped content is written in) a table is a GitHub-style table:
|
|
@@ -283,13 +287,13 @@ Rich text holds tables, on by default. In Markdown (what assistants send and get
|
|
|
283
287
|
| *Lite* | free |
|
|
284
288
|
```
|
|
285
289
|
|
|
286
|
-
The first row is always the header row. A cell holds one line of text with bold, italic and links; images and line breaks can't go in a cell, and a table can't go inside a list or a quote. Write a `|` inside a cell as `\|`. Alignment markers (`:---:`) are accepted and dropped, short rows are padded with empty cells, and cells past the header's width are dropped. To leave tables out of a field, list its `features` without `'table'`: `f.richText({ label: 'Body', features: ['bold', 'italic', 'link'] })`.
|
|
290
|
+
The first row is always the header row. A cell holds one line of text with bold, italic, code and links; images and line breaks can't go in a cell, and a table can't go inside a list or a quote. Write a `|` inside a cell as `\|`. Alignment markers (`:---:`) are accepted and dropped, short rows are padded with empty cells, and cells past the header's width are dropped. To leave tables out of a field, list its `features` without `'table'`: `f.richText({ label: 'Body', features: ['bold', 'italic', 'link'] })`.
|
|
287
291
|
|
|
288
292
|
A table renders as plain HTML with no attributes, for your site's CSS to style: `<table>`, a `<thead>` holding the header row's `<th>` cells, and a `<tbody>` of `<td>` cells when there are rows below the header.
|
|
289
293
|
|
|
290
294
|
### Inline text
|
|
291
295
|
|
|
292
|
-
`f.inlineText({ label, maxLength })` is one line of formatted text, for a headline or a tagline that may need a word in bold or a link: bold, italic and links, and nothing else. It is stored as rich text holding a single paragraph, and the admin edits it on one line. `maxLength` counts the characters of the text, not of its formatting.
|
|
296
|
+
`f.inlineText({ label, maxLength })` is one line of formatted text, for a headline or a tagline that may need a word in bold or a link: bold, italic, code and links, and nothing else. It is stored as rich text holding a single paragraph, and the admin edits it on one line. `maxLength` counts the characters of the text, not of its formatting.
|
|
293
297
|
|
|
294
298
|
Assistants and shipped content write it as one line of Markdown, such as `'**Big** news, see [the plans](inlay:key/pages/pricing)'`. A blank line (a second paragraph), a heading, a list, a line break or an image is refused.
|
|
295
299
|
|
|
@@ -315,7 +319,7 @@ fields: z.object({
|
|
|
315
319
|
`f.multiSelect(options, { label, min, max })` picks any number of a fixed list of options, such as tags:
|
|
316
320
|
|
|
317
321
|
```ts
|
|
318
|
-
tags: f.multiSelect(['
|
|
322
|
+
tags: f.multiSelect(['green', 'blue', 'red'] as const, { label: 'Tags', min: 0, max: 3 }),
|
|
319
323
|
```
|
|
320
324
|
|
|
321
325
|
The value is an array of the options, saved in the options' order without duplicates, and `[]` when nothing is chosen. A draft may hold any number of them; `min` and `max` are checked when it is published. The admin shows one checkbox per option, labelled with the option itself, as `f.select` does. Assistants read and write the array as it is.
|
|
@@ -323,7 +327,7 @@ The value is an array of the options, saved in the options' order without duplic
|
|
|
323
327
|
To list the entries with a tag, filter them in a template:
|
|
324
328
|
|
|
325
329
|
```ts
|
|
326
|
-
const faqs = await ctx.query('faqs', { filter: (e) => e.fields.tags.includes('
|
|
330
|
+
const faqs = await ctx.query('faqs', { filter: (e) => e.fields.tags.includes('green') })
|
|
327
331
|
```
|
|
328
332
|
|
|
329
333
|
An option you remove from the code drops out of the value when it is read, in the admin, on the site and over MCP, while the other options stay; the next save stores the value without it. Export keeps what is stored, so a backup loses nothing.
|
|
@@ -600,7 +604,7 @@ Each default comes from the global when it's filled in, then from the code, then
|
|
|
600
604
|
- **Title.** A page's `f.seo()` title is used exactly as written. Otherwise the page's title goes through the title template, except on the home page (`/`, or a language's root such as `/es`), which keeps its plain title. The 404 page and pages from code routes get the template too. `og:title` and `twitter:title` are the final title.
|
|
601
605
|
- **Description.** The page's `f.seo()` description, then the default.
|
|
602
606
|
- **Share image.** The page's `f.seo()` image, then the global's default image, then the code's `/public` image. Images from the media library are shared as their 1280px JPEG. A `/public` image is an absolute URL versioned like `ctx.asset`'s; if the file isn't there the URL has no version, and the page still renders.
|
|
603
|
-
- **`ogType`.** `defineTemplate({ ogType: 'article' })` makes the template's pages `og:type` `article`, with `article:
|
|
607
|
+
- **`ogType`.** `defineTemplate({ ogType: 'article' })` makes the template's pages `og:type` `article`, with `article:published_time` (`publishedAt`, left out while it is `null`) and `article:modified_time` (the last change). The default is `website`.
|
|
604
608
|
- **Twitter cards.** `twitter:card` is `summary_large_image` when the page has a share image and `summary` when it doesn't. `twitter:title`, `twitter:description` and `twitter:image` repeat the Open Graph values.
|
|
605
609
|
|
|
606
610
|
### Tags from templates
|
|
@@ -727,7 +731,7 @@ export const site = defineSite({
|
|
|
727
731
|
redirects: [
|
|
728
732
|
{ from: '/about-us', to: '/about' },
|
|
729
733
|
{ from: '/blog/:slug', to: '/:slug' },
|
|
730
|
-
{ from: '/g2', to: 'https://www.g2.com/products/
|
|
734
|
+
{ from: '/g2', to: 'https://www.g2.com/products/example/reviews' },
|
|
731
735
|
{ from: '/old-landing', to: '/', status: 302 },
|
|
732
736
|
],
|
|
733
737
|
})
|