From a051a8341db5f319eb3d4fb661a6dcd898859087 Mon Sep 17 00:00:00 2001 From: Hamed Baatour Date: Tue, 1 Jan 2019 15:41:27 +0300 Subject: [PATCH] types(showdown): add missing showdown types for v1.9.0 --- types/showdown/index.d.ts | 70 ++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/types/showdown/index.d.ts b/types/showdown/index.d.ts index 21075fd6c7..df2f17ab52 100644 --- a/types/showdown/index.d.ts +++ b/types/showdown/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Showdown 1.9.0 -// Project: https://github.com/coreyti/showdown -// Definitions by: cbowdon , Pei-Tang Huang , Ariel-Saldana +// Project: https://github.com/showdownjs/showdown +// Definitions by: Hamed Baatour, cbowdon , Pei-Tang Huang , Ariel-Saldana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Showdown; @@ -64,6 +64,10 @@ declare namespace Showdown { output: ShowdownExtension[]; } + interface Metadata { + [meta: string]: string; + } + interface ShowdownOptions { /** * Omit the trailing newline in a code block. Ex: @@ -279,6 +283,43 @@ declare namespace Showdown { * @default false */ backslashEscapesHTMLTags?: boolean; + + /** + * Enable emoji support. Ex: `this is a :smile: emoji. + * + * @default false + */ + emoji?: boolean; + + /** + * Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, + * underscores no longer parses into `` and `` + * + * @default false + */ + underline?: boolean; + + /** + * Outputs a complete html document, including ``, `` and `` tags + * + * @default false + */ + completeHTMLDocument?: boolean; + + /** + * Outputs a complete html document, including ``, `` and `` tags + * + * @default false + */ + metadata?: boolean; + + /** + * Split adjacent blockquote blocks + * + * @default false + */ + splitAdjacentBlockquotes?: boolean; + } @@ -296,11 +337,11 @@ declare namespace Showdown { /** * Converts an HTML string into a markdown string - * - * @param src The input text (HTML) - * @returns The output markdown + * @param src + * @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used. + * @returns {string} */ - makeMarkdown(src: string): string; + makeMarkdown(src: string, HTMLParser?: any): string; /** * Setting a "local" option only affects the specified Converter object. @@ -360,7 +401,20 @@ declare namespace Showdown { * * @param flavor name */ - setFlavor(name: string): void; + setFlavor(name: 'github' | 'original' | 'ghost' | 'vanilla' | 'allOn'): void; + + /** + * Get the metadata of the previously parsed document + * @param raw + * @returns {string|{}} + */ + getMetadata(raw?: boolean): string | Metadata + + /** + * Get the metadata format of the previously parsed document + * @returns {string} + */ + getMetadataFormat(): string; } @@ -477,5 +531,5 @@ declare namespace Showdown { * * @param name */ - function setFlavor(name: string): void; + function setFlavor(name: 'github' | 'original' | 'ghost' | 'vanilla' | 'allOn'): void; }