diff --git a/src/render/ocean_press_render.go b/src/render/ocean_press_render.go index 7a51774..3bf9460 100644 --- a/src/render/ocean_press_render.go +++ b/src/render/ocean_press_render.go @@ -315,19 +315,19 @@ func (r *OceanPressRender) renderAudio(node *ast.Node, entering bool) ast.WalkSt return ast.WalkContinue } -func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus { - if entering { - r.Tag("div", [][]string{{"class", "iframe"}}, false) - tokens := node.Tokens - if r.Options.Sanitize { - tokens = sanitize(tokens) - } - tokens = r.tagSrcPath(tokens) - r.Write(tokens) - r.Tag("/div", nil, false) - } - return ast.WalkContinue -} +// func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus { +// if entering { +// r.Tag("div", [][]string{{"class", "iframe"}}, false) +// tokens := node.Tokens +// if r.Options.Sanitize { +// tokens = sanitize(tokens) +// } +// tokens = r.tagSrcPath(tokens) +// r.Write(tokens) +// r.Tag("/div", nil, false) +// } +// return ast.WalkContinue +// } // func (r *OceanPressRender) Render() (output []byte) { // output = r.BaseRenderer.Render() diff --git a/src/render/ocean_press_render_custom.go b/src/render/ocean_press_render_custom.go index a309098..c478669 100644 --- a/src/render/ocean_press_render_custom.go +++ b/src/render/ocean_press_render_custom.go @@ -65,7 +65,22 @@ func (r *OceanPressRender) Render() (html string, xml string) { return html, xml } - +func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus { + if entering { + attr := [][]string{{"class", "iframe"}} + // 添加自定义属性 + attr = append(attr, node.KramdownIAL...) + r.Tag("div", attr, false) + tokens := node.Tokens + if r.Options.Sanitize { + tokens = sanitize(tokens) + } + tokens = r.tagSrcPath(tokens) + r.Write(tokens) + r.Tag("/div", nil, false) + } + return ast.WalkContinue +} // renderImage 为了实现居中效果 func (r *OceanPressRender) renderImage(node *ast.Node, entering bool) ast.WalkStatus { if entering {