feat: 支持解析表格(简单粗暴的原生html方式)

This commit is contained in:
fengxxc
2023-08-27 12:55:50 +08:00
parent c266359a76
commit cafe91bbc1
4 changed files with 22 additions and 3 deletions

View File

@@ -174,7 +174,7 @@ func formatContent(pieces []parse.Piece, depth int) (string, map[string][]byte)
pieceMdStr = formatImageRefer(piece, len(base64Imgs))
base64Imgs = append(base64Imgs, piece.Val.(string))
case parse.TABLE:
// TODO
pieceMdStr = formatTable(piece)
case parse.CODE_INLINE:
// TODO
case parse.CODE_BLOCK:
@@ -201,6 +201,15 @@ func formatContent(pieces []parse.Piece, depth int) (string, map[string][]byte)
return contentMdStr, saveImageBytes
}
func formatTable(piece parse.Piece) string {
var tableMdStr string
if piece.Attrs != nil && piece.Attrs["type"] == "native" {
tableMdStr = piece.Val.(string)
}
// TODO
return tableMdStr
}
func formatBlockQuote(piece parse.Piece, depth int) (string, map[string][]byte) {
var bqMdString string
var prefix string = ">"