Closed widse closed 1 month ago
notion data μ»΄ν¬λνΈ λ³ν
컀μ€ν μ»΄ν¬λνΈ μ°λ
css μμ
Callout μ κ²½μ° μ¬μ©νλ λΌμ΄λΈλ¬λ¦¬μμ μ§μνμ§ μμ 볡μ‘νκ² μ²λ¦¬ νμμ΅λλ€.
function customizeMdBlocks(blocks: any[]) { return blocks.map(block => { if (block.type === "callout") { const content = block.parent.replace(/>\s*(\S+)\s*/, "").trim(); const newContent = `> [callout] ${content}`; return { ...block, type: "blockquote", parent: newContent }; } return block; }); }
1μ°¨λ‘ λ Έμ λ°μ΄ν°λ₯Ό md blockμΌλ‘ λ³ν μ μ€κ°μ [callout] μ΄λΌλ ν€μλλ₯Ό λ£μ΄μ μλμ κ°μ΄ λΆκΈ°λ‘ λ°μ μ²λ¦¬ ν μ μκ² νμμ΅λλ€.
blockquote: ({ node, ...props }) => { const content = getChildrenContent(props.children); if (content.startsWith("[callout]")) { return <Callout>{content.substring("[callout]".length).trim()}</Callout>; } return <BlockQuote {...props} />;
Anchorμ κ²½μ° κ·Έλλ‘ μ¬μ© ν κ²½μ° μ΄λνλ €λ κ²½λ‘κ° νμλμ΄ μλμ μ½λλ‘ μ΄λνλ €λ νμ΄μ§μμ title, og title λ±μ νμ±νμ¬ ν μ€νΈλ‘ 보μ¬μ£Όκ² μ²λ¦¬νμμ΅λλ€.
export const Anchor = (props: any) => { const parse = async () => { try { const response = await fetch(props.href); const text = await response.text(); const title = text.match(/<title[^>]*>(.*?)<\/title>/i); if (title && title[1]) return title[1]; const ogTitle = text.match(/<meta\s+property="og:title"\s+content="(.*?)"/i); if (ogTitle && ogTitle[1]) return ogTitle[1]; return null; } catch (error) { console.error("Error fetching title:", error); } }; return <Link {...props}>{parse() || props.children}</Link>; };
π PR μ ν
π PR μ€λͺ
notion data μ»΄ν¬λνΈ λ³ν
κ΄λ ¨λ μ΄μ λλ²
β μμ λͺ©λ‘
컀μ€ν μ»΄ν¬λνΈ μ°λ
css μμ
MRνκΈ° μ μ νμΈν΄μ£ΌμΈμ
π λ Όμμ¬ν
callout component
Callout μ κ²½μ° μ¬μ©νλ λΌμ΄λΈλ¬λ¦¬μμ μ§μνμ§ μμ 볡μ‘νκ² μ²λ¦¬ νμμ΅λλ€.
1μ°¨λ‘ λ Έμ λ°μ΄ν°λ₯Ό md blockμΌλ‘ λ³ν μ μ€κ°μ [callout] μ΄λΌλ ν€μλλ₯Ό λ£μ΄μ μλμ κ°μ΄ λΆκΈ°λ‘ λ°μ μ²λ¦¬ ν μ μκ² νμμ΅λλ€.
Anchor component
Anchorμ κ²½μ° κ·Έλλ‘ μ¬μ© ν κ²½μ° μ΄λνλ €λ κ²½λ‘κ° νμλμ΄ μλμ μ½λλ‘ μ΄λνλ €λ νμ΄μ§μμ title, og title λ±μ νμ±νμ¬ ν μ€νΈλ‘ 보μ¬μ£Όκ² μ²λ¦¬νμμ΅λλ€.
μΆκ° κ³ λ € μ¬ν
π ETC