UNPKG

npf2html

Version:

Converts Tumblr's Neue Post Format to plain HTML

58 lines (57 loc) 2.22 kB
import { AskLayout } from './ask-layout'; import { AudioBlock } from './audio-block'; import { ImageBlock } from './image-block'; import { LinkBlock } from './link-block'; import { Options } from './options'; import { PaywallBlock } from './paywall-block'; import { PollBlock } from './poll-block'; import { RowsLayout } from './rows-layout'; import { TextBlock } from './text-block'; import { VideoBlock } from './video-block'; export { AskLayout } from './ask-layout'; export { Attribution, PostAttribution, Post, LinkAttribution, BlogAttribution, AppAttribution, } from './attribution'; export { AudioBlock } from './audio-block'; export { BlogInfo } from './blog-info'; export { ImageBlock } from './image-block'; export { LinkBlock } from './link-block'; export { Media, VisualMedia } from './media'; export { Options } from './options'; export { PollAnswer, PollBlock, PollSettings } from './poll-block'; export { PaywallBlock, PaywallBlockCta, PaywallBlockDivider, } from './paywall-block'; export { Renderer } from './renderer'; export { RowsDisplay, RowsLayout } from './rows-layout'; export { TextBlock, TextBlockNoIndent, TextBlockIndented } from './text-block'; export { InlineFormat, InlineFormatBasic, InlineFormatLink, InlineFormatMention, InlineFormatColor, } from './inline-format'; export { VideoBlock, IFrame } from './video-block'; /** * A single discrete unit of content. * * @see https://www.tumblr.com/docs/npf#content-blocks * * @category Content */ export type ContentBlock = AudioBlock | ImageBlock | LinkBlock | PaywallBlock | PollBlock | TextBlock | VideoBlock; /** * A block of unknown type, not documented as part of the Tumblr API. * * @category Content */ export interface UnknownBlock extends Record<string, unknown> { /** The type of the block. */ type: string; } /** * A layout indicating how to lay out contents blocks. * * @see https://www.tumblr.com/docs/npf#layout-blocks * * @category Layout */ export type Layout = AskLayout | RowsLayout; /** * Converts each NPF block in {@link blocks} to plain HTML and concatenates them * into a single string. * * @category Main */ export default function npf2html(blocks: ContentBlock[], options?: Options): string;