@@ -16,6 +16,7 @@ import {
1616 DaisySuccessIcon ,
1717 DaisyWarningIcon ,
1818} from "@/daisyAlertIcon" ;
19+ import { CSSProperties } from "react" ;
1920
2021export function StyledMarkdown ( props : {
2122 content : string ;
@@ -68,6 +69,20 @@ const baseComponents: Components = {
6869 hr : ( ) => null ,
6970 blockquote : ( { node, className, children, ...props } ) => (
7071 < blockquote
72+ className = { clsx ( "alert" , className , "mx-2 my-2" , "flex" ) }
73+ { ...props }
74+ >
75+ < div
76+ // <p>がmx-2 my-2を設定するので、その分広げて相殺
77+ className = "flex-1 w-full -m-2"
78+ >
79+ { children }
80+ </ div >
81+ </ blockquote >
82+ ) ,
83+ aside : ( { node, className, children, ...props } ) => (
84+ // remarkGitHubAlerts.ts でalertをasideタグにしている
85+ < aside
7186 className = { clsx (
7287 "alert" ,
7388 className ,
@@ -86,9 +101,15 @@ const baseComponents: Components = {
86101 ) : className ?. includes ( "alert-error" ) ? (
87102 < DaisyErrorIcon />
88103 ) : null }
89- { /* <p>がmx-2 my-2を設定するので、その分広げて相殺 */ }
90- < div className = "flex-1 w-full -m-2 self-center" > { children } </ div >
91- </ blockquote >
104+ < div
105+ // <p>がmx-2 my-2を設定するので、その分広げて相殺
106+ className = "flex-1 w-full -m-2 self-center"
107+ // alertネスト対応
108+ style = { { "--alert-color" : "initial" } as CSSProperties }
109+ >
110+ { children }
111+ </ div >
112+ </ aside >
92113 ) ,
93114 pre : ( { children } ) => children ,
94115 code : ( props ) => < AutoCodeBlock interactive = { false } { ...props } /> ,
0 commit comments