@geekity/cms 0.39.0 → 0.41.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/admin/pages/appearance/look.njk +135 -0
- package/admin/pages/dashboard/home.njk +9 -3
- package/admin/pages/documents/conflict.njk +35 -10
- package/admin/pages/documents/editor.njk +28 -0
- package/admin/pages/documents/list.njk +44 -1
- package/admin/pages/settings/general.njk +4 -0
- package/admin/pages/users/edit.njk +1 -1
- package/admin/src/admin.css +32 -0
- package/admin/static/admin.css +197 -3
- package/admin/static/dashboard.js +51 -23
- package/admin/static/editor.js +19 -19
- package/dist/admin/autosave-client.d.ts +85 -0
- package/dist/admin/autosave-client.d.ts.map +1 -0
- package/dist/admin/autosave-client.js +218 -0
- package/dist/admin/autosave-client.js.map +1 -0
- package/dist/admin/autosave.d.ts +11 -0
- package/dist/admin/autosave.d.ts.map +1 -0
- package/dist/admin/autosave.js +76 -0
- package/dist/admin/autosave.js.map +1 -0
- package/dist/admin/dashboard.d.ts +2 -2
- package/dist/admin/dashboard.d.ts.map +1 -1
- package/dist/admin/dashboard.js +23 -15
- package/dist/admin/dashboard.js.map +1 -1
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +205 -16
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/flash.d.ts +2 -0
- package/dist/admin/flash.d.ts.map +1 -1
- package/dist/admin/flash.js +12 -0
- package/dist/admin/flash.js.map +1 -1
- package/dist/admin/focus-mode.d.ts +39 -0
- package/dist/admin/focus-mode.d.ts.map +1 -0
- package/dist/admin/focus-mode.js +81 -0
- package/dist/admin/focus-mode.js.map +1 -0
- package/dist/admin/formatting.d.ts +0 -2
- package/dist/admin/formatting.d.ts.map +1 -1
- package/dist/admin/formatting.js +0 -8
- package/dist/admin/formatting.js.map +1 -1
- package/dist/admin/look.d.ts +12 -0
- package/dist/admin/look.d.ts.map +1 -0
- package/dist/admin/look.js +179 -0
- package/dist/admin/look.js.map +1 -0
- package/dist/admin/menu.d.ts.map +1 -1
- package/dist/admin/menu.js +5 -3
- package/dist/admin/menu.js.map +1 -1
- package/dist/admin/preview.d.ts.map +1 -1
- package/dist/admin/preview.js +1 -0
- package/dist/admin/preview.js.map +1 -1
- package/dist/admin/routes.d.ts.map +1 -1
- package/dist/admin/routes.js +6 -4
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/settings-fields.d.ts +1 -1
- package/dist/admin/settings-fields.d.ts.map +1 -1
- package/dist/admin/settings-fields.js +1 -0
- package/dist/admin/settings-fields.js.map +1 -1
- package/dist/admin/settings-general.d.ts.map +1 -1
- package/dist/admin/settings-general.js +1 -0
- package/dist/admin/settings-general.js.map +1 -1
- package/dist/admin/templates.d.ts +1 -0
- package/dist/admin/templates.d.ts.map +1 -1
- package/dist/admin/templates.js +2 -1
- package/dist/admin/templates.js.map +1 -1
- package/dist/admin/users.d.ts.map +1 -1
- package/dist/admin/users.js +2 -0
- package/dist/admin/users.js.map +1 -1
- package/dist/admin/widget-fediverse.js +1 -1
- package/dist/admin/widget-posting.d.ts.map +1 -1
- package/dist/admin/widget-posting.js +4 -75
- package/dist/admin/widget-posting.js.map +1 -1
- package/dist/admin/widget-scheduled.js +1 -1
- package/dist/admin/widget-top-posts.js +1 -1
- package/dist/autosave/index.d.ts +5 -0
- package/dist/autosave/index.d.ts.map +1 -0
- package/dist/autosave/index.js +3 -0
- package/dist/autosave/index.js.map +1 -0
- package/dist/autosave/key.d.ts +13 -0
- package/dist/autosave/key.d.ts.map +1 -0
- package/dist/autosave/key.js +29 -0
- package/dist/autosave/key.js.map +1 -0
- package/dist/autosave/store.d.ts +23 -0
- package/dist/autosave/store.d.ts.map +1 -0
- package/dist/autosave/store.js +114 -0
- package/dist/autosave/store.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cms/app.d.ts.map +1 -1
- package/dist/cms/app.js +1 -0
- package/dist/cms/app.js.map +1 -1
- package/dist/cms/boot.d.ts.map +1 -1
- package/dist/cms/boot.js +2 -0
- package/dist/cms/boot.js.map +1 -1
- package/dist/cms/create.d.ts +6 -0
- package/dist/cms/create.d.ts.map +1 -1
- package/dist/cms/create.js +1 -0
- package/dist/cms/create.js.map +1 -1
- package/dist/cms/server-error.d.ts.map +1 -1
- package/dist/cms/server-error.js +6 -6
- package/dist/cms/server-error.js.map +1 -1
- package/dist/cms/services.d.ts +2 -0
- package/dist/cms/services.d.ts.map +1 -1
- package/dist/cms/services.js +9 -0
- package/dist/cms/services.js.map +1 -1
- package/dist/{micropub/content.d.ts → content/html-to-markdown.d.ts} +1 -1
- package/dist/content/html-to-markdown.d.ts.map +1 -0
- package/dist/{micropub/content.js → content/html-to-markdown.js} +11 -9
- package/dist/content/html-to-markdown.js.map +1 -0
- package/dist/content/post-type.d.ts +1 -0
- package/dist/content/post-type.d.ts.map +1 -1
- package/dist/content/post-type.js +1 -1
- package/dist/content/post-type.js.map +1 -1
- package/dist/content/review.d.ts +14 -0
- package/dist/content/review.d.ts.map +1 -1
- package/dist/content/review.js +31 -8
- package/dist/content/review.js.map +1 -1
- package/dist/content/write.d.ts +8 -0
- package/dist/content/write.d.ts.map +1 -1
- package/dist/content/write.js +1 -1
- package/dist/content/write.js.map +1 -1
- package/dist/files/data-files.d.ts +2 -0
- package/dist/files/data-files.d.ts.map +1 -1
- package/dist/files/data-files.js +12 -0
- package/dist/files/data-files.js.map +1 -1
- package/dist/fonts/css.d.ts +25 -0
- package/dist/fonts/css.d.ts.map +1 -0
- package/dist/fonts/css.js +88 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/family.d.ts +23 -0
- package/dist/fonts/family.d.ts.map +1 -0
- package/dist/fonts/family.js +41 -0
- package/dist/fonts/family.js.map +1 -0
- package/dist/fonts/index.d.ts +10 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +6 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/job.d.ts +20 -0
- package/dist/fonts/job.d.ts.map +1 -0
- package/dist/fonts/job.js +49 -0
- package/dist/fonts/job.js.map +1 -0
- package/dist/fonts/roles.d.ts +53 -0
- package/dist/fonts/roles.d.ts.map +1 -0
- package/dist/fonts/roles.js +64 -0
- package/dist/fonts/roles.js.map +1 -0
- package/dist/fonts/store.d.ts +69 -0
- package/dist/fonts/store.d.ts.map +1 -0
- package/dist/fonts/store.js +237 -0
- package/dist/fonts/store.js.map +1 -0
- package/dist/maintenance.d.ts +1 -0
- package/dist/maintenance.d.ts.map +1 -1
- package/dist/maintenance.js +1 -1
- package/dist/maintenance.js.map +1 -1
- package/dist/micropub/create.js +1 -1
- package/dist/micropub/create.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/settings/registry.d.ts.map +1 -1
- package/dist/settings/registry.js +5 -1
- package/dist/settings/registry.js.map +1 -1
- package/dist/settings/types.d.ts +1 -1
- package/dist/settings/types.d.ts.map +1 -1
- package/dist/site/dashboard-layout.d.ts +33 -26
- package/dist/site/dashboard-layout.d.ts.map +1 -1
- package/dist/site/dashboard-layout.js +94 -39
- package/dist/site/dashboard-layout.js.map +1 -1
- package/dist/site/namespace.d.ts +5 -0
- package/dist/site/namespace.d.ts.map +1 -1
- package/dist/site/namespace.js +40 -1
- package/dist/site/namespace.js.map +1 -1
- package/dist/store/schema.d.ts.map +1 -1
- package/dist/store/schema.js +4 -0
- package/dist/store/schema.js.map +1 -1
- package/dist/store/sessions.d.ts +2 -1
- package/dist/store/sessions.d.ts.map +1 -1
- package/dist/store/sessions.js +30 -12
- package/dist/store/sessions.js.map +1 -1
- package/dist/theme/font-family.d.ts +13 -0
- package/dist/theme/font-family.d.ts.map +1 -0
- package/dist/theme/font-family.js +21 -0
- package/dist/theme/font-family.js.map +1 -0
- package/dist/theme/scheme-tokens.d.ts +50 -0
- package/dist/theme/scheme-tokens.d.ts.map +1 -0
- package/dist/theme/scheme-tokens.js +240 -0
- package/dist/theme/scheme-tokens.js.map +1 -0
- package/dist/theme/site-data.d.ts +12 -0
- package/dist/theme/site-data.d.ts.map +1 -1
- package/dist/theme/site-data.js +15 -0
- package/dist/theme/site-data.js.map +1 -1
- package/dist/theme/themes.d.ts +74 -0
- package/dist/theme/themes.d.ts.map +1 -1
- package/dist/theme/themes.js +100 -9
- package/dist/theme/themes.js.map +1 -1
- package/dist/util/file-size.d.ts +3 -0
- package/dist/util/file-size.d.ts.map +1 -0
- package/dist/util/file-size.js +9 -0
- package/dist/util/file-size.js.map +1 -0
- package/dist/web/asset-routes.d.ts.map +1 -1
- package/dist/web/asset-routes.js +2 -1
- package/dist/web/asset-routes.js.map +1 -1
- package/dist/web/conversation.d.ts +15 -0
- package/dist/web/conversation.d.ts.map +1 -1
- package/dist/web/conversation.js +10 -3
- package/dist/web/conversation.js.map +1 -1
- package/dist/web/document-page.d.ts.map +1 -1
- package/dist/web/document-page.js +11 -13
- package/dist/web/document-page.js.map +1 -1
- package/dist/web/embed.d.ts.map +1 -1
- package/dist/web/embed.js +4 -2
- package/dist/web/embed.js.map +1 -1
- package/dist/web/env.d.ts +2 -0
- package/dist/web/env.d.ts.map +1 -1
- package/dist/web/federation-routes.d.ts.map +1 -1
- package/dist/web/federation-routes.js +2 -1
- package/dist/web/federation-routes.js.map +1 -1
- package/dist/web/feed-routes.d.ts +4 -2
- package/dist/web/feed-routes.d.ts.map +1 -1
- package/dist/web/feed-routes.js +22 -4
- package/dist/web/feed-routes.js.map +1 -1
- package/dist/web/feed-source.d.ts +1 -1
- package/dist/web/feed-source.d.ts.map +1 -1
- package/dist/web/feed-source.js +1 -1
- package/dist/web/feed-source.js.map +1 -1
- package/dist/web/font-routes.d.ts +13 -0
- package/dist/web/font-routes.d.ts.map +1 -0
- package/dist/web/font-routes.js +27 -0
- package/dist/web/font-routes.js.map +1 -0
- package/dist/web/listing-pages.d.ts.map +1 -1
- package/dist/web/listing-pages.js +12 -14
- package/dist/web/listing-pages.js.map +1 -1
- package/dist/web/maintenance.d.ts.map +1 -1
- package/dist/web/maintenance.js +12 -8
- package/dist/web/maintenance.js.map +1 -1
- package/dist/web/manifest.d.ts +8 -5
- package/dist/web/manifest.d.ts.map +1 -1
- package/dist/web/manifest.js +10 -7
- package/dist/web/manifest.js.map +1 -1
- package/dist/web/markdown-conversation.d.ts +72 -0
- package/dist/web/markdown-conversation.d.ts.map +1 -0
- package/dist/web/markdown-conversation.js +63 -0
- package/dist/web/markdown-conversation.js.map +1 -0
- package/dist/web/markdown-page.d.ts +39 -0
- package/dist/web/markdown-page.d.ts.map +1 -1
- package/dist/web/markdown-page.js +5 -2
- package/dist/web/markdown-page.js.map +1 -1
- package/dist/web/markdown-representation.d.ts +31 -1
- package/dist/web/markdown-representation.d.ts.map +1 -1
- package/dist/web/markdown-representation.js +161 -8
- package/dist/web/markdown-representation.js.map +1 -1
- package/dist/web/negotiate.d.ts +3 -2
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +7 -3
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/oembed.d.ts +17 -3
- package/dist/web/oembed.d.ts.map +1 -1
- package/dist/web/oembed.js +68 -26
- package/dist/web/oembed.js.map +1 -1
- package/dist/web/render.d.ts +64 -5
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +185 -10
- package/dist/web/render.js.map +1 -1
- package/dist/web/request.d.ts +0 -3
- package/dist/web/request.d.ts.map +1 -1
- package/dist/web/request.js +0 -7
- package/dist/web/request.js.map +1 -1
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +13 -7
- package/dist/web/routes.js.map +1 -1
- package/dist/web/search.d.ts +6 -3
- package/dist/web/search.d.ts.map +1 -1
- package/dist/web/search.js +20 -5
- package/dist/web/search.js.map +1 -1
- package/dist/web/site-index.d.ts.map +1 -1
- package/dist/web/site-index.js +2 -1
- package/dist/web/site-index.js.map +1 -1
- package/dist/web/status-pages.d.ts +19 -0
- package/dist/web/status-pages.d.ts.map +1 -0
- package/dist/web/status-pages.js +44 -0
- package/dist/web/status-pages.js.map +1 -0
- package/dist/webmention/fetch-public.d.ts +6 -0
- package/dist/webmention/fetch-public.d.ts.map +1 -1
- package/dist/webmention/fetch-public.js +6 -1
- package/dist/webmention/fetch-public.js.map +1 -1
- package/package.json +1 -1
- package/themes/default/layouts/404.md.njk +8 -0
- package/themes/default/layouts/410.md.njk +7 -0
- package/themes/default/layouts/500.md.njk +8 -0
- package/themes/default/layouts/503.md.njk +9 -0
- package/themes/default/layouts/base.njk +28 -16
- package/themes/default/layouts/page.njk +4 -8
- package/themes/default/partials/bio.njk +1 -1
- package/themes/default/partials/contact-form.njk +1 -1
- package/themes/default/partials/markdown-footer.md.njk +121 -3
- package/themes/default/partials/markdown-header.md.njk +102 -0
- package/themes/default/partials/markdown-reply.md.njk +31 -0
- package/themes/default/src/style.css +326 -15
- package/themes/default/static/style.css +489 -3
- package/themes/default/theme.json +23 -1
- package/dist/micropub/content.d.ts.map +0 -1
- package/dist/micropub/content.js.map +0 -1
package/dist/web/manifest.js
CHANGED
|
@@ -17,15 +17,18 @@ const MANIFEST_CONTENT_TYPE = 'application/manifest+json; charset=utf-8';
|
|
|
17
17
|
* The manifest of one site.
|
|
18
18
|
*
|
|
19
19
|
* The name is the site's title for both the long and the short form; a
|
|
20
|
-
* launcher shortens a long one itself. The colours are the chosen
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* launcher shortens a long one itself. The colours are the chosen scheme's
|
|
21
|
+
* `themeColor`, dark under the dark mode and light otherwise, or the theme's
|
|
22
|
+
* light `themeColor` under a theme with no schemes. In the default theme that
|
|
23
|
+
* is also the page background, so the splash screen a launcher paints before
|
|
24
|
+
* the first page loads is the page's own colour. Every URL carries the base
|
|
25
|
+
* path of a site served from a subdirectory.
|
|
25
26
|
*/
|
|
26
27
|
export function webManifest(input) {
|
|
27
|
-
const { config } = input;
|
|
28
|
-
const color =
|
|
28
|
+
const { config, scheme } = input;
|
|
29
|
+
const color = scheme === undefined
|
|
30
|
+
? input.colors.themeColor.light
|
|
31
|
+
: scheme.scheme.themeColor[scheme.mode === 'dark' ? 'dark' : 'light'];
|
|
29
32
|
return {
|
|
30
33
|
name: input.title,
|
|
31
34
|
short_name: input.title,
|
package/dist/web/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/web/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/web/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAK5D;;;;;;GAMG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAErD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAE3C,MAAM,qBAAqB,GAAG,0CAA0C,CAAC;AAiBzE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,KAM3B;IACC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,KAAK,GACT,MAAM,KAAK,SAAS;QAClB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK;QAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAA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AE,CAAC,CAAC;AACzC,CAAC;AAED,gFAAgF;AAChF,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { CommentThread, Conversation, InteractionCounts, InteractionSource } from '../comments/conversation.ts';
|
|
2
|
+
import type { RsvpValue } from '../content/rsvp.ts';
|
|
3
|
+
/** Somebody in a facepile, or a reply's author: their name, and where it links. */
|
|
4
|
+
export interface MarkdownPerson {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly url?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
/** A reply as the Markdown footer threads it, or the placeholder for a hidden one. */
|
|
9
|
+
export type MarkdownReply = {
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly source: InteractionSource;
|
|
12
|
+
readonly author: MarkdownPerson;
|
|
13
|
+
readonly url?: string | undefined;
|
|
14
|
+
readonly published: Date;
|
|
15
|
+
readonly rsvp?: {
|
|
16
|
+
readonly value: RsvpValue;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
/** Its words as Markdown, empty when it has none. */
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly replies: readonly MarkdownReply[];
|
|
22
|
+
} | {
|
|
23
|
+
readonly key: string;
|
|
24
|
+
readonly withheld: true;
|
|
25
|
+
readonly replies: readonly MarkdownReply[];
|
|
26
|
+
};
|
|
27
|
+
/** {@link Conversation} with HTML turned into Markdown and each face into a link. */
|
|
28
|
+
export interface MarkdownConversation {
|
|
29
|
+
readonly replies: readonly MarkdownReply[];
|
|
30
|
+
readonly likes: readonly MarkdownPerson[];
|
|
31
|
+
readonly boosts: readonly MarkdownPerson[];
|
|
32
|
+
readonly mentions: readonly MarkdownPerson[];
|
|
33
|
+
readonly rsvps: readonly {
|
|
34
|
+
readonly value: RsvpValue;
|
|
35
|
+
readonly label: string;
|
|
36
|
+
readonly people: readonly MarkdownPerson[];
|
|
37
|
+
}[];
|
|
38
|
+
readonly counts: InteractionCounts;
|
|
39
|
+
}
|
|
40
|
+
/** A reply a reader can see, as {@link MarkdownReply} has it. */
|
|
41
|
+
export type MarkdownSaid = Exclude<MarkdownReply, {
|
|
42
|
+
readonly withheld: true;
|
|
43
|
+
}>;
|
|
44
|
+
/** A native comment's page (TASK-318) as `layouts/comment.njk` draws it, for the Markdown partials. */
|
|
45
|
+
export interface MarkdownCommentThread {
|
|
46
|
+
readonly post: {
|
|
47
|
+
readonly label: string;
|
|
48
|
+
readonly url: string;
|
|
49
|
+
readonly author?: MarkdownPerson | undefined;
|
|
50
|
+
/** Its date as the front matter writes it, which the `date` filter reads. */
|
|
51
|
+
readonly date?: string | undefined;
|
|
52
|
+
/** Its summary as plain text, empty when it has none. */
|
|
53
|
+
readonly summary: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* What the comment answers, from the top-level comment down to its parent,
|
|
57
|
+
* each without its replies. `null` is one a reader may not see.
|
|
58
|
+
*/
|
|
59
|
+
readonly ancestors: readonly (MarkdownSaid | null)[];
|
|
60
|
+
/** The comment, with its replies threaded under it. */
|
|
61
|
+
readonly comment: MarkdownSaid;
|
|
62
|
+
readonly onPostUrl: string;
|
|
63
|
+
}
|
|
64
|
+
/** A comment's thread with HTML turned into Markdown; `post` is what the code knows of the post. */
|
|
65
|
+
export declare function markdownCommentThread(thread: CommentThread, post: MarkdownCommentThread['post'], onPostUrl: string): MarkdownCommentThread;
|
|
66
|
+
/**
|
|
67
|
+
* The conversation `conversation.njk` draws, for the Markdown partials. A
|
|
68
|
+
* like or a boost links to its person and a mention to its page, as the
|
|
69
|
+
* facepiles do.
|
|
70
|
+
*/
|
|
71
|
+
export declare function markdownConversation(conversation: Conversation): MarkdownConversation;
|
|
72
|
+
//# sourceMappingURL=markdown-conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-conversation.d.ts","sourceRoot":"","sources":["../../src/web/markdown-conversation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EAEZ,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,sFAAsF;AACtF,MAAM,MAAM,aAAa,GACrB;IACE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAClF,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;CAC5C,GACD;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAElG,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,QA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ACrB,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,EACnC,SAAS,EAAE,MAAM,GAChB,qBAAqB,CASvB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,oBAAoB,CAoBrF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isWithheld } from '../comments/conversation.js';
|
|
2
|
+
import { markdownFromHtml } from '../content/html-to-markdown.js';
|
|
3
|
+
import { parseHtml, textOf } from '../util/html-tree.js';
|
|
4
|
+
import { escapeMarkdown } from './markdown-page.js';
|
|
5
|
+
/** A comment's thread with HTML turned into Markdown; `post` is what the code knows of the post. */
|
|
6
|
+
export function markdownCommentThread(thread, post, onPostUrl) {
|
|
7
|
+
return {
|
|
8
|
+
post,
|
|
9
|
+
ancestors: thread.ancestors.map((step) => step === null ? null : markdownSaid({ ...step, replies: [] })),
|
|
10
|
+
comment: markdownSaid(thread.comment),
|
|
11
|
+
onPostUrl,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The conversation `conversation.njk` draws, for the Markdown partials. A
|
|
16
|
+
* like or a boost links to its person and a mention to its page, as the
|
|
17
|
+
* facepiles do.
|
|
18
|
+
*/
|
|
19
|
+
export function markdownConversation(conversation) {
|
|
20
|
+
const person = (item) => ({
|
|
21
|
+
label: item.author.name,
|
|
22
|
+
url: item.author.url ?? item.url ?? undefined,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
replies: conversation.replies.map(markdownReply),
|
|
26
|
+
likes: conversation.likes.map(person),
|
|
27
|
+
boosts: conversation.boosts.map(person),
|
|
28
|
+
mentions: conversation.mentions.map((item) => ({
|
|
29
|
+
label: item.author.name,
|
|
30
|
+
url: item.url ?? item.author.url ?? undefined,
|
|
31
|
+
})),
|
|
32
|
+
rsvps: conversation.rsvps.map(({ value, label, people }) => ({
|
|
33
|
+
value,
|
|
34
|
+
label,
|
|
35
|
+
people: people.map(person),
|
|
36
|
+
})),
|
|
37
|
+
counts: conversation.counts,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function markdownReply(reply) {
|
|
41
|
+
if (isWithheld(reply)) {
|
|
42
|
+
return { key: reply.key, withheld: true, replies: reply.replies.map(markdownReply) };
|
|
43
|
+
}
|
|
44
|
+
return markdownSaid(reply);
|
|
45
|
+
}
|
|
46
|
+
function markdownSaid(reply) {
|
|
47
|
+
return {
|
|
48
|
+
key: reply.key,
|
|
49
|
+
source: reply.source,
|
|
50
|
+
author: { label: reply.author.name, url: reply.author.url ?? undefined },
|
|
51
|
+
url: reply.url ?? undefined,
|
|
52
|
+
published: reply.published,
|
|
53
|
+
...(reply.rsvp === undefined ? {} : { rsvp: reply.rsvp }),
|
|
54
|
+
text: markdownText(reply.content),
|
|
55
|
+
replies: reply.replies.map(markdownReply),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function markdownText(html) {
|
|
59
|
+
if (html.trim() === '')
|
|
60
|
+
return '';
|
|
61
|
+
return markdownFromHtml(html) ?? escapeMarkdown(textOf(parseHtml(html)));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=markdown-conversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-conversation.js","sourceRoot":"","sources":["../../src/web/markdown-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAUzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA6DpD,oGAAoG;AACpG,MAAM,UAAU,qBAAqB,CACnC,MAAqB,EACrB,IAAmC,EACnC,SAAiB;IAEjB,OAAO;QACL,IAAI;QACJ,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IA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{ MarkdownCommentThread } from './markdown-conversation.ts';
|
|
2
3
|
/**
|
|
3
4
|
* The Markdown representation of a page: front matter, the theme's header, the
|
|
4
5
|
* page's own Markdown and the theme's footer.
|
|
@@ -26,10 +27,17 @@ export interface MarkdownBio {
|
|
|
26
27
|
readonly note?: string | undefined;
|
|
27
28
|
readonly links: readonly MarkdownLink[];
|
|
28
29
|
}
|
|
30
|
+
/** One feed a page advertises: its title, its URL, and which format it is in. */
|
|
31
|
+
export interface MarkdownFeed extends MarkdownLink {
|
|
32
|
+
readonly format: 'RSS' | 'Atom' | 'JSON Feed';
|
|
33
|
+
/** Its media type, as the HTML head's `<link type>` says it. */
|
|
34
|
+
readonly type: string;
|
|
35
|
+
}
|
|
29
36
|
/** What the header and footer partials are given beside `site` and `menus`. */
|
|
30
37
|
export interface MarkdownChrome {
|
|
31
38
|
/** The path the page is served at, which marks the current menu item. */
|
|
32
39
|
readonly url: string;
|
|
40
|
+
readonly type: 'post' | 'page' | 'listing' | 'comment' | 'status';
|
|
33
41
|
/** The heading the header writes, absent when the body opens with its own. */
|
|
34
42
|
readonly title?: string | undefined;
|
|
35
43
|
readonly previous?: MarkdownLink | undefined;
|
|
@@ -38,6 +46,35 @@ export interface MarkdownChrome {
|
|
|
38
46
|
readonly byline?: MarkdownLink | undefined;
|
|
39
47
|
/** On an author archive, and on a solo author site's homepage. */
|
|
40
48
|
readonly bio?: MarkdownBio | undefined;
|
|
49
|
+
/** The feeds the HTML head advertises, in its order. */
|
|
50
|
+
readonly feeds: readonly MarkdownFeed[];
|
|
51
|
+
/** On a comment's own page: the comment and its place in the thread. */
|
|
52
|
+
readonly thread?: MarkdownCommentThread | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What a post answers or cites, as its HTML citation line names it: a reply's
|
|
56
|
+
* target, an RSVP's event, or what it likes, reposts or bookmarks.
|
|
57
|
+
*/
|
|
58
|
+
export interface MarkdownCite {
|
|
59
|
+
/** `In reply to`, an RSVP's phrase such as `Going to`, `Liked`, `Reposted` or `Bookmarked`. */
|
|
60
|
+
readonly verb: string;
|
|
61
|
+
/** The page cited: the original when the target is a silo copy of one. */
|
|
62
|
+
readonly url: string;
|
|
63
|
+
/** Its title, or what the HTML calls it without one, such as `a page on example.com`. */
|
|
64
|
+
readonly name: string;
|
|
65
|
+
/** Who wrote it, absent when the name already ends with them. */
|
|
66
|
+
readonly author?: string | undefined;
|
|
67
|
+
/** The site it is on, when it names no author. */
|
|
68
|
+
readonly site?: string | undefined;
|
|
69
|
+
/** An event's start, the instant to print, and the zone to print it in when it is not the site's. */
|
|
70
|
+
readonly startDate?: Date | undefined;
|
|
71
|
+
readonly startZone?: string | undefined;
|
|
72
|
+
/** When it was published, on a target that is no event. */
|
|
73
|
+
readonly published?: Date | undefined;
|
|
74
|
+
/** Where an event takes place. */
|
|
75
|
+
readonly location?: string | undefined;
|
|
76
|
+
/** The silo copy the post also answers, when `url` is the original. */
|
|
77
|
+
readonly copy?: string | undefined;
|
|
41
78
|
}
|
|
42
79
|
/** One post of a dated list. */
|
|
43
80
|
export interface MarkdownEntry extends MarkdownLink {
|
|
@@ -78,4 +115,6 @@ export declare function linkList(links: readonly MarkdownLink[], markdownUrl: Ma
|
|
|
78
115
|
*/
|
|
79
116
|
export declare function escapeMarkdown(text: string): string;
|
|
80
117
|
export declare function oneLine(text: string): string;
|
|
118
|
+
/** Text with the characters that would open emphasis, code, a link or raw HTML escaped. */
|
|
119
|
+
export declare function escapeInline(text: string): string;
|
|
81
120
|
//# sourceMappingURL=markdown-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-page.d.ts","sourceRoot":"","sources":["../../src/web/markdown-page.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-page.d.ts","sourceRoot":"","sources":["../../src/web/markdown-page.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,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
|
|
69
69
|
*/
|
|
70
70
|
export function escapeMarkdown(text) {
|
|
71
|
-
return oneLine(text)
|
|
72
|
-
.replace(/[\\`*_[\]<>~|]/g, (character) => `\\${character}`)
|
|
71
|
+
return escapeInline(oneLine(text))
|
|
73
72
|
.replace(/^[#+-]/, '\\$&')
|
|
74
73
|
.replace(/^(\d+)([.)])/, '$1\\$2');
|
|
75
74
|
}
|
|
76
75
|
export function oneLine(text) {
|
|
77
76
|
return text.replace(/\s+/g, ' ').trim();
|
|
78
77
|
}
|
|
78
|
+
/** Text with the characters that would open emphasis, code, a link or raw HTML escaped. */
|
|
79
|
+
export function escapeInline(text) {
|
|
80
|
+
return text.replace(/[\\`*_[\]<>~|]/g, (character) => `\\${character}`);
|
|
81
|
+
}
|
|
79
82
|
//# sourceMappingURL=markdown-page.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-page.js","sourceRoot":"","sources":["../../src/web/markdown-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-page.js","sourceRoot":"","sources":["../../src/web/markdown-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAuG/B,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEnE,gEAAgE;AAChE,MAAM,UAAU,qBAAqB,CACnC,MAAsB,EACtB,WAAwB;IAExB,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC;QAChC,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxF,GAAG,CAAC,M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AC,IAAI,EAAE,EAAE,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;SAC5E,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC/B,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;SACzB,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
|
+
import type { CommentThread } from '../comments/conversation.ts';
|
|
2
3
|
import type { Document } from '../content/document.ts';
|
|
4
|
+
import type { SearchHit } from '../content/store.ts';
|
|
3
5
|
import type { GeekityEnv } from './env.ts';
|
|
4
6
|
import type { Archive } from './listing-subject.ts';
|
|
5
7
|
import type { MarkdownUrl } from './markdown-page.ts';
|
|
6
8
|
import type { Pagination } from './pagination.ts';
|
|
7
|
-
|
|
9
|
+
import type { StatusPageName } from './render.ts';
|
|
10
|
+
/**
|
|
11
|
+
* A document's Markdown at `url`, which is its permalink everywhere but the
|
|
12
|
+
* front page. The front matter says where it is served; everything the page
|
|
13
|
+
* lists about the document, such as its comments feed, is the stored one's.
|
|
14
|
+
*/
|
|
15
|
+
export declare function documentMarkdown(c: Context<GeekityEnv>, document: Document, url: string): string;
|
|
8
16
|
export declare function listingMarkdown(c: Context<GeekityEnv>, archive: Archive, page: {
|
|
9
17
|
href: string;
|
|
10
18
|
title: string;
|
|
11
19
|
pagination: Pagination;
|
|
12
20
|
documents: readonly Document[];
|
|
13
21
|
}): string;
|
|
22
|
+
/**
|
|
23
|
+
* A native comment's page in Markdown: the post and the comments it answers
|
|
24
|
+
* above it, its own words as the body, and its replies below.
|
|
25
|
+
*/
|
|
26
|
+
export declare function commentMarkdown(c: Context<GeekityEnv>, found: CommentThread): string;
|
|
27
|
+
/**
|
|
28
|
+
* One page of search results in the listing's shape: what was asked and how
|
|
29
|
+
* much was found, the results with their snippets, and the pager. Every link
|
|
30
|
+
* to another page of the results keeps the query.
|
|
31
|
+
*/
|
|
32
|
+
export declare function searchMarkdown(c: Context<GeekityEnv>, page: {
|
|
33
|
+
href: string;
|
|
34
|
+
query: string;
|
|
35
|
+
pagination: Pagination;
|
|
36
|
+
hits: readonly SearchHit[];
|
|
37
|
+
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* A 404, 410, 500 or 503 in Markdown: the theme's body for it between the
|
|
40
|
+
* header and footer every page has, with the maintenance page's back-by time
|
|
41
|
+
* in the front matter as well.
|
|
42
|
+
*/
|
|
43
|
+
export declare function statusMarkdown(c: Context<GeekityEnv>, page: StatusPageName, url: string, until?: Date): string;
|
|
14
44
|
export declare function markdownUrlFor(c: Context<GeekityEnv>, pageUrl: string): MarkdownUrl;
|
|
15
45
|
//# sourceMappingURL=markdown-representation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-representation.d.ts","sourceRoot":"","sources":["../../src/web/markdown-representation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-representation.d.ts","sourceRoot":"","sources":["../../src/web/markdown-representation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OA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,EAAE,CAAA;CAAE,GACxF,MAAM,CA+CR;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EACtB,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,IAAI,GACX,MAAM,CAmBR;AAsCD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAGnF"}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
|
+
import { commentAnchor, commentKeyAt } from '../comments/conversation.js';
|
|
2
|
+
import { commentPageHref } from '../content/guids.js';
|
|
1
3
|
import { rewriteMarkdownLinks } from '../content/markdown-links.js';
|
|
2
4
|
import { decodedPath } from '../content/redirects.js';
|
|
3
5
|
import { isServed } from '../content/served.js';
|
|
4
6
|
import { landing, siteLinkAt } from '../content/site-links.js';
|
|
5
7
|
import { calendarDayIn } from '../content/time.js';
|
|
6
8
|
import { documentFrontMatter, normalizeBody } from '../content/writer.js';
|
|
9
|
+
import { COMMENTS_TITLE_PREFIX, FEED_FORMATS, commentsFeedPath, feedPathUnder, } from './feed-source.js';
|
|
7
10
|
import { absoluteUrl } from '../util/url.js';
|
|
8
|
-
import { authorContext } from '../site/authors.js';
|
|
11
|
+
import { authorContext, siteAuthorContext } from '../site/authors.js';
|
|
12
|
+
import { feedExcerpt } from '../content/excerpt.js';
|
|
9
13
|
import { siteTimezone } from '../theme/site-data.js';
|
|
10
|
-
import {
|
|
14
|
+
import { commentedPost } from './conversation.js';
|
|
15
|
+
import { markdownCommentThread } from './markdown-conversation.js';
|
|
16
|
+
import { bioOf, entryList, escapeMarkdown, linkList, markdownFile, namedAuthor, navigationFrontMatter, oneLine, } from './markdown-page.js';
|
|
11
17
|
import { representationHref } from './negotiate.js';
|
|
18
|
+
import { STATUS_PAGES } from './render.js';
|
|
12
19
|
import { classifyPath } from './paths.js';
|
|
13
20
|
import { documentLabel, encodePath } from './request.js';
|
|
21
|
+
import { SEARCH_PATH, snippetMarkdown } from './search.js';
|
|
14
22
|
import { servedPath, siteView } from './site-view.js';
|
|
15
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A document's Markdown at `url`, which is its permalink everywhere but the
|
|
25
|
+
* front page. The front matter says where it is served; everything the page
|
|
26
|
+
* lists about the document, such as its comments feed, is the stored one's.
|
|
27
|
+
*/
|
|
28
|
+
export function documentMarkdown(c, document, url) {
|
|
16
29
|
const writer = authorContext(siteView(c).users(), document.author);
|
|
17
30
|
const neighbours = document.type === 'post' ? c.var.store.neighbours(document) : {};
|
|
18
31
|
const link = (neighbour) => neighbour === undefined
|
|
@@ -20,16 +33,26 @@ export function documentMarkdown(c, document) {
|
|
|
20
33
|
: { label: documentLabel(c, neighbour), url: neighbour.permalink };
|
|
21
34
|
const title = oneLine(document.title);
|
|
22
35
|
const body = normalizeBody(document.body);
|
|
36
|
+
const siteTitle = c.var.renderer.site().title;
|
|
23
37
|
const chrome = {
|
|
24
|
-
url
|
|
38
|
+
url,
|
|
39
|
+
type: document.type,
|
|
25
40
|
title: title === '' || /^#[ \t]/.test(body.trimStart()) ? undefined : title,
|
|
26
41
|
previous: link(neighbours.previous),
|
|
27
42
|
next: link(neighbours.next),
|
|
28
43
|
byline: document.type === 'post' && writer?.url !== undefined
|
|
29
44
|
? { label: writer.name, url: writer.url }
|
|
30
45
|
: undefined,
|
|
46
|
+
feeds: [
|
|
47
|
+
...siteFeeds(siteTitle),
|
|
48
|
+
...(isServed(document, c.var.store.now())
|
|
49
|
+
? [
|
|
50
|
+
feed('rss', `${COMMENTS_TITLE_PREFIX}${documentLabel(c, document)}`, commentsFeedPath(document.permalink)),
|
|
51
|
+
]
|
|
52
|
+
: []),
|
|
53
|
+
],
|
|
31
54
|
};
|
|
32
|
-
return markdownPage(c, namedAuthor(documentFrontMatter(document), writer), chrome, [rewriteMarkdownLinks(body, markdownHrefFor(c,
|
|
55
|
+
return markdownPage(c, namedAuthor(documentFrontMatter({ ...document, permalink: url }), writer), chrome, [rewriteMarkdownLinks(body, markdownHrefFor(c, url))], { frontPage: url === '/' ? document : undefined, document });
|
|
33
56
|
}
|
|
34
57
|
export function listingMarkdown(c, archive, page) {
|
|
35
58
|
const { next, previous } = page.pagination.href;
|
|
@@ -41,12 +64,18 @@ export function listingMarkdown(c, archive, page) {
|
|
|
41
64
|
const markdownUrl = markdownUrlFor(c, url);
|
|
42
65
|
const newer = previous === null ? undefined : { label: 'Newer posts', url: previous };
|
|
43
66
|
const older = next === null ? undefined : { label: 'Older posts', url: next };
|
|
67
|
+
const ownFeeds = archive.feedHref('rss') === feedPathUnder('/', 'rss') ? [] : FEED_FORMATS;
|
|
44
68
|
const chrome = {
|
|
45
69
|
url,
|
|
70
|
+
type: 'listing',
|
|
46
71
|
title: page.title,
|
|
47
72
|
previous: newer,
|
|
48
73
|
next: older,
|
|
49
74
|
bio: bioOf(archive.author),
|
|
75
|
+
feeds: [
|
|
76
|
+
...siteFeeds(site.title),
|
|
77
|
+
...ownFeeds.map((format) => feed(format, archive.feedTitle(site), archive.feedHref(format))),
|
|
78
|
+
],
|
|
50
79
|
};
|
|
51
80
|
const entries = page.documents.map((document) => ({
|
|
52
81
|
label: documentLabel(c, document),
|
|
@@ -55,12 +84,126 @@ export function listingMarkdown(c, archive, page) {
|
|
|
55
84
|
description: document.description,
|
|
56
85
|
}));
|
|
57
86
|
const pager = [newer, older].filter((link) => link !== undefined);
|
|
87
|
+
const { document } = archive.context;
|
|
58
88
|
return markdownPage(c, { title: page.title, permalink: url }, chrome, [
|
|
59
89
|
description === '' ? '' : `> ${description}`,
|
|
90
|
+
document === undefined
|
|
91
|
+
? ''
|
|
92
|
+
: rewriteMarkdownLinks(normalizeBody(document.body), markdownHrefFor(c, document.permalink)),
|
|
60
93
|
entries.length === 0 ? '' : `## Posts\n\n${entryList(entries, markdownUrl)}`,
|
|
61
94
|
pager.length === 0 ? '' : `## More posts\n\n${linkList(pager, markdownUrl)}`,
|
|
62
95
|
]);
|
|
63
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* A native comment's page in Markdown: the post and the comments it answers
|
|
99
|
+
* above it, its own words as the body, and its replies below.
|
|
100
|
+
*/
|
|
101
|
+
export function commentMarkdown(c, found) {
|
|
102
|
+
const { post, comment } = found;
|
|
103
|
+
const url = commentPageHref(comment.key);
|
|
104
|
+
const users = siteView(c).users();
|
|
105
|
+
const site = c.var.renderer.site();
|
|
106
|
+
const label = documentLabel(c, post);
|
|
107
|
+
const by = authorContext(users, post.author) ?? siteAuthorContext(users, site.author);
|
|
108
|
+
const thread = markdownCommentThread(found, {
|
|
109
|
+
label,
|
|
110
|
+
url: post.permalink,
|
|
111
|
+
author: by === undefined ? undefined : { label: by.name, url: by.url },
|
|
112
|
+
date: post.date,
|
|
113
|
+
summary: feedExcerpt(post),
|
|
114
|
+
}, `${post.permalink}#${commentAnchor(comment.key)}`);
|
|
115
|
+
const chrome = {
|
|
116
|
+
url,
|
|
117
|
+
type: 'comment',
|
|
118
|
+
title: `Comment by ${comment.author.name} on ${label}`,
|
|
119
|
+
feeds: siteFeeds(site.title),
|
|
120
|
+
thread,
|
|
121
|
+
};
|
|
122
|
+
return markdownPage(c, {
|
|
123
|
+
title: `${comment.author.name} on ${label}`,
|
|
124
|
+
permalink: url,
|
|
125
|
+
author: comment.author.name,
|
|
126
|
+
date: comment.published,
|
|
127
|
+
}, chrome, [thread.comment.text]);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* One page of search results in the listing's shape: what was asked and how
|
|
131
|
+
* much was found, the results with their snippets, and the pager. Every link
|
|
132
|
+
* to another page of the results keeps the query.
|
|
133
|
+
*/
|
|
134
|
+
export function searchMarkdown(c, page) {
|
|
135
|
+
const { query, pagination } = page;
|
|
136
|
+
const { next, previous } = pagination.href;
|
|
137
|
+
const home = siteView(c).pages.home;
|
|
138
|
+
const site = c.var.renderer.site();
|
|
139
|
+
const timezone = siteTimezone(site);
|
|
140
|
+
const markdownUrl = markdownUrlFor(c, SEARCH_PATH);
|
|
141
|
+
const title = query === ''
|
|
142
|
+
? 'Search'
|
|
143
|
+
: `Search results for “${query}”${pagination.pageNumber > 0 ? `, page ${String(pagination.pageNumber + 1)}` : ''}`;
|
|
144
|
+
const newer = previous === null ? undefined : { label: 'Previous results', url: previous };
|
|
145
|
+
const older = next === null ? undefined : { label: 'More results', url: next };
|
|
146
|
+
const chrome = {
|
|
147
|
+
url: SEARCH_PATH,
|
|
148
|
+
type: 'listing',
|
|
149
|
+
title,
|
|
150
|
+
previous: newer,
|
|
151
|
+
next: older,
|
|
152
|
+
feeds: siteFeeds(site.title),
|
|
153
|
+
};
|
|
154
|
+
const asked = `“${escapeMarkdown(query)}”`;
|
|
155
|
+
const summary = query === ''
|
|
156
|
+
? 'Search this site by adding `?q=` and the words to this URL.'
|
|
157
|
+
: pagination.total === 0
|
|
158
|
+
? `Nothing found for ${asked}.`
|
|
159
|
+
: `${pagination.total === 1 ? 'One result' : `${String(pagination.total)} results`} for ${asked}.`;
|
|
160
|
+
const entries = page.hits.map(({ document, snippet }) => ({
|
|
161
|
+
label: documentLabel(c, document),
|
|
162
|
+
url: servedPath(document, home),
|
|
163
|
+
date: document.date === undefined ? undefined : calendarDayIn(document.date, timezone),
|
|
164
|
+
description: snippetMarkdown(snippet),
|
|
165
|
+
}));
|
|
166
|
+
const pager = [newer, older].filter((link) => link !== undefined);
|
|
167
|
+
return markdownPage(c, { title, permalink: page.href, ...(query === '' ? {} : { query }) }, chrome, [
|
|
168
|
+
summary,
|
|
169
|
+
entries.length === 0 ? '' : `## Results\n\n${entryList(entries, markdownUrl)}`,
|
|
170
|
+
pager.length === 0 ? '' : `## More results\n\n${linkList(pager, markdownUrl)}`,
|
|
171
|
+
]);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* A 404, 410, 500 or 503 in Markdown: the theme's body for it between the
|
|
175
|
+
* header and footer every page has, with the maintenance page's back-by time
|
|
176
|
+
* in the front matter as well.
|
|
177
|
+
*/
|
|
178
|
+
export function statusMarkdown(c, page, url, until) {
|
|
179
|
+
const { title } = STATUS_PAGES[page];
|
|
180
|
+
const chrome = {
|
|
181
|
+
url,
|
|
182
|
+
type: 'status',
|
|
183
|
+
title,
|
|
184
|
+
feeds: siteFeeds(c.var.renderer.site().title),
|
|
185
|
+
};
|
|
186
|
+
const body = c.var.renderer.renderStatusMarkdown(page, {
|
|
187
|
+
url,
|
|
188
|
+
markdownUrl: markdownUrlFor(c, url),
|
|
189
|
+
until,
|
|
190
|
+
});
|
|
191
|
+
return markdownPage(c, { title, ...(until === undefined ? {} : { until: until.toISOString() }) }, chrome, [body]);
|
|
192
|
+
}
|
|
193
|
+
const FEED_NAMES = {
|
|
194
|
+
rss: { format: 'RSS', type: 'application/rss+xml' },
|
|
195
|
+
atom: { format: 'Atom', type: 'application/atom+xml' },
|
|
196
|
+
json: { format: 'JSON Feed', type: 'application/feed+json' },
|
|
197
|
+
};
|
|
198
|
+
function feed(format, label, url) {
|
|
199
|
+
return { label, url, ...FEED_NAMES[format] };
|
|
200
|
+
}
|
|
201
|
+
function siteFeeds(siteTitle) {
|
|
202
|
+
return [
|
|
203
|
+
...FEED_FORMATS.map((format) => feed(format, siteTitle, feedPathUnder('/', format))),
|
|
204
|
+
feed('rss', `${siteTitle} comments`, commentsFeedPath()),
|
|
205
|
+
];
|
|
206
|
+
}
|
|
64
207
|
function markdownPage(c, frontMatter, chrome, blocks, pages = {}) {
|
|
65
208
|
const markdownUrl = markdownUrlFor(c, chrome.url);
|
|
66
209
|
const { header, footer } = c.var.renderer.renderMarkdownChrome(chrome, {
|
|
@@ -86,7 +229,7 @@ export function markdownUrlFor(c, pageUrl) {
|
|
|
86
229
|
* redirect, then whatever is served at the path, then a moved document, then
|
|
87
230
|
* a declared redirect, so `/?p=7`, a `redirect_from` and the homepage's own
|
|
88
231
|
* permalink all land on the `.md` of the document they reach. A fragment is
|
|
89
|
-
* kept.
|
|
232
|
+
* kept, and so is the query of a link to the search.
|
|
90
233
|
*/
|
|
91
234
|
function markdownHrefFor(c, pageUrl) {
|
|
92
235
|
const { config } = c.var;
|
|
@@ -98,6 +241,11 @@ function markdownHrefFor(c, pageUrl) {
|
|
|
98
241
|
if (sitePath === '/')
|
|
99
242
|
return '/';
|
|
100
243
|
const directory = sitePath.endsWith('/') ? sitePath : `${sitePath}/`;
|
|
244
|
+
if (directory === SEARCH_PATH)
|
|
245
|
+
return SEARCH_PATH;
|
|
246
|
+
const key = commentKeyAt(directory);
|
|
247
|
+
if (key !== undefined)
|
|
248
|
+
return hasCommentPage(c, key) ? directory : undefined;
|
|
101
249
|
const candidates = [directory, sitePath];
|
|
102
250
|
for (const candidate of candidates) {
|
|
103
251
|
const match = classifyPath(view, candidate);
|
|
@@ -123,8 +271,13 @@ function markdownHrefFor(c, pageUrl) {
|
|
|
123
271
|
if (served === undefined)
|
|
124
272
|
return undefined;
|
|
125
273
|
const { pathname } = new URL(absoluteUrl(encodePath(served), config.baseUrl));
|
|
126
|
-
const
|
|
127
|
-
|
|
274
|
+
const target = URL.parse(href, page);
|
|
275
|
+
const query = served === SEARCH_PATH ? (target?.search ?? '') : '';
|
|
276
|
+
return `${representationHref(`${pathname}${query}`, 'markdown')}${target?.hash ?? ''}`;
|
|
128
277
|
};
|
|
129
278
|
}
|
|
279
|
+
function hasCommentPage(c, key) {
|
|
280
|
+
const post = commentedPost(c.var, key);
|
|
281
|
+
return post !== undefined && isServed(post, c.var.store.now());
|
|
282
|
+
}
|
|
130
283
|
//# sourceMappingURL=markdown-representation.js.map
|