npf2html
Version:
Converts Tumblr's Neue Post Format to plain HTML
41 lines (40 loc) • 1.11 kB
TypeScript
import { Renderer } from './renderer';
/**
* Content blocks organized in rows, with variable elements per row.
*
* @see https://www.tumblr.com/docs/npf#layout-block-type-rows
*
* @category Layout
*/
export interface RowsLayout {
type: 'rows';
/** A list of ways to display sets of rows. */
display: RowsDisplay[];
/** How the content should be truncated. */
truncate_after?: number;
}
/**
* An object describing how to display a single row.
*
* @category Layout
*/
export interface RowsDisplay {
/** An array of block indices to use in this row. */
blocks: number[];
/**
* The display mode for this row.
*
* @see https://www.tumblr.com/docs/npf#layout-block-display-mode-carousel
*/
mode?: {
type: 'carousel';
};
}
/**
* Wraps {@link html} as single row.
*
* @category Layout
*/
export declare function renderRowLayout(renderer: Renderer, display: RowsDisplay, html: string): string;
/** Renders {@link html} as a "below the fold" read more. */
export declare function renderTruncateLayout(renderer: Renderer, html: string): string;