import { IContentType } from '../../ContentTypes/ContentType.interface' import { BlockFactory } from '../Black.factory' import { Block } from '../Block' type BookmarkContentType = { caption: any[], url: string } export class Bookmark extends Block { static tagName:string = 'a' toHTML(): string { const bookmarkContent:BookmarkContentType = this.content as BookmarkContentType const url = bookmarkContent.url const classTag = ['notion', 'bookmark'] const innerContents = bookmarkContent.caption.map((captionRawJson:IContentType) => BlockFactory.transformWithType(captionRawJson)) const textContent = innerContents.map((contentItem:IContentType) => contentItem.toHTML()).join('') || url return `<${Bookmark.tagName} class="${classTag.join(' ')}" href="${url}">${textContent}` } }