Skip to content

Commit

Permalink
修复部分 Block 未转换,导致丢失内容的问题 (#25)
Browse files Browse the repository at this point in the history
修复当BlockType为Heading并拥有Children不转换Children

---------

Co-authored-by: Jason Lee <[email protected]>
  • Loading branch information
RaBBBBBIT and huacnlee authored Nov 1, 2024
1 parent 333c8d3 commit e375af1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions feishu-docx/src/markdown_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,20 @@ export class MarkdownRenderer extends Renderer {
buf.write('\n');
}

// For type: 2 render children
if (block.block_type == BlockType.Text) {
// For block with children: render children
const childrenBlockList = [
BlockType.Text,
BlockType.Heading1,
BlockType.Heading2,
BlockType.Heading3,
BlockType.Heading4,
BlockType.Heading5,
BlockType.Heading6,
BlockType.Heading7,
BlockType.Heading8,
BlockType.Heading9
]
if (childrenBlockList.find(type => type === block.block_type)) {
block.children?.forEach((childId, _) => {
const child = this.blockMap[childId];
buf.write(this.parseBlock(child, this.indent));
Expand Down Expand Up @@ -801,7 +813,7 @@ export class MarkdownRenderer extends Renderer {

buf.write(el.outerHTML);
buf.write('\n');

this.addFileToken('board', board.token);
console.info("New board added: " + board.token)

Expand Down

0 comments on commit e375af1

Please sign in to comment.