mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-25 02:56:38 +00:00
temporarily fix img
This commit is contained in:
parent
faa1124298
commit
304b1c3ab7
1 changed files with 88 additions and 88 deletions
176
astro.config.mts
176
astro.config.mts
|
|
@ -10,94 +10,94 @@ import md5 from "md5"
|
||||||
|
|
||||||
function pipeline() {
|
function pipeline() {
|
||||||
return [
|
return [
|
||||||
() => tree => {
|
// () => tree => {
|
||||||
visit(tree, "element", (node, index) => {
|
// visit(tree, "element", (node, index) => {
|
||||||
if (node.tagName === "p" && node.children[0].tagName === "img") {
|
// if (node.tagName === "p" && node.children[0].tagName === "img") {
|
||||||
node.tagName = "figure"
|
// node.tagName = "figure"
|
||||||
let img = node.children[0]
|
// let img = node.children[0]
|
||||||
let sign = md5(img.properties.src)
|
// let sign = md5(img.properties.src)
|
||||||
let data = img.properties.alt.split("|")
|
// let data = img.properties.alt.split("|")
|
||||||
let alt = data[0]
|
// let alt = data[0]
|
||||||
let size = "big"
|
// let size = "big"
|
||||||
if (data.length > 1) {
|
// if (data.length > 1) {
|
||||||
size = data[1]
|
// size = data[1]
|
||||||
}
|
// }
|
||||||
let classes = ["image component image-full-bleed body-copy-wide nr-scroll-animation nr-scroll-animation--on"]
|
// let classes = ["image component image-full-bleed body-copy-wide nr-scroll-animation nr-scroll-animation--on"]
|
||||||
classes.push(`image-${size}`)
|
// classes.push(`image-${size}`)
|
||||||
node.properties.className = classes
|
// node.properties.className = classes
|
||||||
node.children = [
|
// node.children = [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "div",
|
// tagName: "div",
|
||||||
properties: {
|
// properties: {
|
||||||
className: ["component-content"],
|
// className: ["component-content"],
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "div",
|
// tagName: "div",
|
||||||
properties: {
|
// properties: {
|
||||||
className: ["image-share-sheet"],
|
// className: ["image-share-sheet"],
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "div",
|
// tagName: "div",
|
||||||
properties: {
|
// properties: {
|
||||||
className: [`image image-load image-asset image-${sign}`],
|
// className: [`image image-load image-asset image-${sign}`],
|
||||||
id: `lht${sign}`,
|
// id: `lht${sign}`,
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "picture",
|
// tagName: "picture",
|
||||||
properties: {
|
// properties: {
|
||||||
className: ["picture"],
|
// className: ["picture"],
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "img",
|
// tagName: "img",
|
||||||
properties: {
|
// properties: {
|
||||||
"data-src": img.properties.src,
|
// "data-src": img.properties.src,
|
||||||
alt: alt,
|
// alt: alt,
|
||||||
className: ["picture-image"],
|
// className: ["picture-image"],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "div",
|
// tagName: "div",
|
||||||
properties: {
|
// properties: {
|
||||||
className: ["image-description"],
|
// className: ["image-description"],
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "element",
|
// type: "element",
|
||||||
tagName: "div",
|
// tagName: "div",
|
||||||
properties: {
|
// properties: {
|
||||||
className: ["image-caption"],
|
// className: ["image-caption"],
|
||||||
},
|
// },
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
type: "text",
|
// type: "text",
|
||||||
value: alt,
|
// value: alt,
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
() => tree => {
|
() => tree => {
|
||||||
tree.children.forEach(node => {
|
tree.children.forEach(node => {
|
||||||
if (node.type === "raw") {
|
if (node.type === "raw") {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue