@refrakt-md/html 0.24.5 → 0.25.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/dist/render.d.ts +4 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +6 -3
- package/dist/render.js.map +1 -1
- package/package.json +5 -5
package/dist/render.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { HtmlTheme } from './theme.js';
|
|
|
3
3
|
export interface RenderPageInput {
|
|
4
4
|
theme: HtmlTheme;
|
|
5
5
|
page: LayoutPageData;
|
|
6
|
+
/** Whether to render the site-wide search UI (header button + Cmd/Ctrl+K
|
|
7
|
+
* dialog). Defaults to `true`. Pass `false` — sourced from
|
|
8
|
+
* `SiteConfig.search` — to strip the search chrome from this page. */
|
|
9
|
+
search?: boolean;
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
12
|
* Render a page's content to an HTML string.
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB;;2EAEuE;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAqBzD"}
|
package/dist/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { layoutTransform, renderToHtml, matchRouteRule } from '@refrakt-md/transform';
|
|
1
|
+
import { layoutTransform, renderToHtml, matchRouteRule, withoutSearchLayout } from '@refrakt-md/transform';
|
|
2
2
|
import { applyHtmlTransforms } from './tree-transforms.js';
|
|
3
3
|
/**
|
|
4
4
|
* Render a page's content to an HTML string.
|
|
@@ -8,15 +8,18 @@ import { applyHtmlTransforms } from './tree-transforms.js';
|
|
|
8
8
|
* use `renderFullPage` for that.
|
|
9
9
|
*/
|
|
10
10
|
export function renderPage(input) {
|
|
11
|
-
const { theme, page } = input;
|
|
11
|
+
const { theme, page, search } = input;
|
|
12
12
|
// Resolve layout from route rules
|
|
13
13
|
const layoutName = matchRouteRule(page.url, theme.manifest.routeRules ?? []);
|
|
14
|
-
|
|
14
|
+
let layoutConfig = theme.layouts[layoutName] ?? theme.layouts['default'];
|
|
15
15
|
if (!layoutConfig) {
|
|
16
16
|
// No layout config — render the bare renderable
|
|
17
17
|
const transformed = applyHtmlTransforms(page.renderable);
|
|
18
18
|
return renderToHtml(transformed);
|
|
19
19
|
}
|
|
20
|
+
if (search === false) {
|
|
21
|
+
layoutConfig = withoutSearchLayout(layoutConfig);
|
|
22
|
+
}
|
|
20
23
|
// Apply layout transform → tree transforms → HTML
|
|
21
24
|
const tree = layoutTransform(layoutConfig, page, 'rf');
|
|
22
25
|
const transformed = applyHtmlTransforms(tree);
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAW3D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAChD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEtC,kCAAkC;IAClC,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IAC7E,IAAI,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,gDAAgD;QAChD,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAiB,CAAC;QACzE,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACtB,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED,kDAAkD;IAClD,MAAM,IAAI,GAAG,eAAe,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAiB,CAAC;IAC9D,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/html",
|
|
3
3
|
"description": "Pure HTML renderer for refrakt.md content — no framework required",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"build": "tsc"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@refrakt-md/behaviors": "0.
|
|
35
|
-
"@refrakt-md/content": "0.
|
|
36
|
-
"@refrakt-md/transform": "0.
|
|
37
|
-
"@refrakt-md/types": "0.
|
|
34
|
+
"@refrakt-md/behaviors": "0.25.0",
|
|
35
|
+
"@refrakt-md/content": "0.25.0",
|
|
36
|
+
"@refrakt-md/transform": "0.25.0",
|
|
37
|
+
"@refrakt-md/types": "0.25.0"
|
|
38
38
|
}
|
|
39
39
|
}
|