讨论加特殊图标

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-03-21 15:49:12 +08:00
parent 0ed747a035
commit dd619643c9
202 changed files with 2973 additions and 2866 deletions

View File

@@ -43,7 +43,7 @@ function tagToString(tag) {
return SelfClosingTags.includes(tag.tag) ? openTag : `${openTag}${content}</${tag.tag}>`;
}
function ssrRenderTags(tags) {
function ssrRenderTags(tags, options) {
const schema = { htmlAttrs: {}, bodyAttrs: {}, tags: { head: [], bodyClose: [], bodyOpen: [] } };
for (const tag of tags) {
if (tag.tag === "htmlAttrs" || tag.tag === "bodyAttrs") {
@@ -52,16 +52,17 @@ function ssrRenderTags(tags) {
}
schema.tags[tag.tagPosition || "head"].push(tagToString(tag));
}
const lineBreaks = !options?.omitLineBreaks ? "\n" : "";
return {
headTags: schema.tags.head.join("\n"),
bodyTags: schema.tags.bodyClose.join("\n"),
bodyTagsOpen: schema.tags.bodyOpen.join("\n"),
headTags: schema.tags.head.join(lineBreaks),
bodyTags: schema.tags.bodyClose.join(lineBreaks),
bodyTagsOpen: schema.tags.bodyOpen.join(lineBreaks),
htmlAttrs: propsToString(schema.htmlAttrs),
bodyAttrs: propsToString(schema.bodyAttrs)
};
}
async function renderSSRHead(head) {
async function renderSSRHead(head, options) {
const beforeRenderCtx = { shouldRender: true };
await head.hooks.callHook("ssr:beforeRender", beforeRenderCtx);
if (!beforeRenderCtx.shouldRender) {
@@ -75,7 +76,7 @@ async function renderSSRHead(head) {
}
const ctx = { tags: await head.resolveTags() };
await head.hooks.callHook("ssr:render", ctx);
const html = ssrRenderTags(ctx.tags);
const html = ssrRenderTags(ctx.tags, options);
const renderCtx = { tags: ctx.tags, html };
await head.hooks.callHook("ssr:rendered", renderCtx);
return renderCtx.html;

View File

@@ -1,7 +1,7 @@
{
"name": "@unhead/ssr",
"type": "module",
"version": "1.8.9",
"version": "1.8.10",
"author": "Harlan Wilton <harlan@harlanzw.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
@@ -29,8 +29,8 @@
"dist"
],
"dependencies": {
"@unhead/schema": "1.8.9",
"@unhead/shared": "1.8.9"
"@unhead/schema": "1.8.10",
"@unhead/shared": "1.8.10"
},
"scripts": {
"build": "unbuild .",