@botonic/plugin-contentful
Version:
Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet
56 lines (55 loc) • 1.93 kB
TypeScript
export declare enum MarkupType {
/**
* CommonMark markdown
* https://spec.commonmark.org/
* Italics is *text* or _text_
* Bold is **text** or __text__
* */
MARKDOWN = "markdown",
/**
* Bold is *text* and italics is _text_
* https://faq.whatsapp.com/en/android/26000002/
**/
WHATSAPP = "whatsapp",
/**
* https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf
* https://guides.github.com/features/mastering-markdown/
*/
GITHUB = "github",
/**
* Contentful supports github flavoured markdown. Its editor by default generates:
* Italics with *text*
* Bold with __text__
*/
CONTENTFUL = "contentful"
}
export declare enum TokenType {
STRONG = "strong",
EMPHASIS = "em",
ESCAPE = "escape",
PARAGRAPH = "paragraph",
TEXT = "text",
SPACE = "space",
CODE = "code",
HEADING = "heading"
}
export interface Token {
type: TokenType | TokenType.STRONG | TokenType.EMPHASIS | TokenType.PARAGRAPH | TokenType.TEXT | TokenType.SPACE | TokenType.CODE | TokenType.HEADING;
raw?: string;
text?: string;
tokens?: Token[];
items?: Token[];
}
export declare abstract class MarkUp {
readonly type: MarkupType;
protected constructor(type: MarkupType);
abstract parse(txt: string): Token[];
render(tokens: Token[], separator?: string): string;
protected abstract renderToken(token: Token): string;
/** Remove an inline content (https://spec.commonmark.org/0.29/#inlines)
* eg. disableInlines('_hi_', EMPHASIS) = 'hi' */
disableInlines(input: string, inlineTypes: TokenType[]): string;
abstract wrapWithInline(input: string, inlineType: TokenType): string;
}
export declare function visitTokens(input: Token[], visitor: (t: Token) => void): void;
export declare function recursiveTokenFind(tokens: Token[], predicate: (t: Token) => boolean): Token[];