Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/showdown

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/showdown - npm Package Compare versions

Comparing version 1.9.2 to 1.9.3

898

showdown/index.d.ts

@@ -6,3 +6,4 @@ // Type definitions for Showdown 1.9.0

// Pei-Tang Huang <https://github.com/tan9>,
// Ariel-Saldana <https://github.com/arielsaldana>
// Ariel-Saldana <https://github.com/arielsaldana>,
// Yisrael Eliav <https://github.com/yisraelx>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -13,4 +14,52 @@

/**
* Showdown namespace
*
* @see https://github.com/showdownjs/showdown/blob/master/src/showdown.js
*/
declare namespace Showdown {
/**
* Showdown event listener.
*/
interface EventListener {
/**
* @param evtName - The event name.
* @param text - The current convert value.
* @param converter - The converter instance.
* @param options - The converter options.
* @param globals - A global parsed data of the current conversion.
* @returns Can be returned string value to change the current convert value (`text`).
* @example
* Change by returns string value.
* ```ts
* let listener: EventListener = (evtName, text, converter, options, globals) => doSome(text);
* ```
*/
(evtName: string, text: string, converter: Converter, options: ShowdownOptions, globals: ConverterGlobals): void | string;
}
interface ConverterGlobals {
converter?: Converter;
gDimensions?: {
width?: number;
height?: number;
};
gHtmlBlocks?: string[];
gHtmlMdBlocks?: string[];
gHtmlSpans?: string[];
gListLevel?: number;
gTitles?: {[key: string]: string};
gUrls?: {[key: string]: string};
ghCodeBlocks?: {codeblock?: string, text?: string}[];
hashLinkCounts?: {[key: string]: number};
langExtensions?: ShowdownExtension[];
metadata?: {
parsed?: {[key: string]: string};
raw?: string;
format?: string;
};
outputModifiers?: ShowdownExtension[];
}
interface Extension {

@@ -20,6 +69,12 @@ /**

*
* * `lang` - Language extensions add new markdown syntax to showdown.
* * `output` - Output extensions (or modifiers) alter the HTML output generated by showdown
* * `lang` - Language extensions add new markdown syntax to showdown.
* * `output` - Output extensions (or modifiers) alter the HTML output generated by showdown.
* * `listener` - Listener extensions for listening to a conversion event.
*/
type: string;
/**
* Event listeners functions that called on the conversion, when the `event` occurs.
*/
listeners?: {[event: string]: EventListener}
}

@@ -30,2 +85,11 @@

* Two properties are given, `regex` and `replace`.
*
* @example
* ```ts
* let myExt: RegexReplaceExtension = {
* type: 'lang',
* regex: /markdown/g,
* replace: 'showdown'
* };
* ```
*/

@@ -52,2 +116,10 @@ interface RegexReplaceExtension extends Extension {

* The filter property should be a function that acts as a callback.
*
* @example
* ```ts
* let myExt: ShowdownExtension = {
* type: 'lang',
* filter: (text: string, converter: Converter) => text.replace('#', '*')
* };
* ```
*/

@@ -64,4 +136,23 @@ interface FilterExtension extends Extension {

* + Output Modifiers -- After showdown has run, and generated HTML, an output modifier would change that HTML. For example, say you wanted to change <div class="header"> to be <header>, that would be an output modifier.
*
* + Listener Extension -- Listener extensions for listen to conversion events.
*
* Each extension can provide two combinations of interfaces for showdown.
*
* @example
* ```ts
* let myext: ShowdownExtension = {
* type: 'output',
* filter(text, converter, options) {
* // ... do stuff to text ...
* return text;
* },
* listeners: {
* ['lists.after'](evtName, text, converter, options, globals){
* // ... do stuff to text ...
* return text;
* },
* // ...
* }
* };
* ```
*/

@@ -71,2 +162,12 @@ interface ShowdownExtension extends RegexReplaceExtension, FilterExtension {

/**
* Showdown extensions store object.
*/
interface ShowdownExtensions {
[name: string]: ShowdownExtension[]
}
/**
* Showdown converter extensions store object.
*/
interface ConverterExtensions {

@@ -81,14 +182,36 @@ language: ShowdownExtension[];

/**
* Showdown options.
*
* @see https://github.com/showdownjs/showdown#valid-options
* @see https://github.com/showdownjs/showdown/wiki/Showdown-options
* @see https://github.com/showdownjs/showdown/blob/master/src/options.js
*/
interface ShowdownOptions {
/**
* Omit the trailing newline in a code block. Ex:
* Omit the trailing newline in a code block.
* By default, showdown adds a newline before the closing tags in code blocks. By enabling this option, that newline is removed.
* This option affects both indented and fenced (gfm style) code blocks.
*
* This:
* <code><pre>var foo = 'bar';
* </pre></code>
* @example
*
* Becomes this:
* <code><pre>var foo = 'bar';</pre></code>
* **input**:
*
* ```md
* var foo = 'bar';
* ```
*
* **omitExtraWLInCodeBlocks** = false:
*
* ```html
* <code><pre>var foo = 'bar';
* </pre></code>
* ```
* **omitExtraWLInCodeBlocks** = true:
*
* ```html
* <code><pre>var foo = 'bar';</pre></code>
* ```
* @default false
* @since 1.0.0
*/

@@ -98,5 +221,26 @@ omitExtraWLInCodeBlocks?: boolean;

/**
* Disable the automatic generation of header ids. Setting to true overrides <strong>prefixHeaderId</strong>.
* Disable the automatic generation of header ids.
* Showdown generates an id for headings automatically. This is useful for linking to a specific header.
* This behavior, however, can be disabled with this option.
*
* @example
* **input**:
*
* ```md
* # This is a header
* ```
*
* **noHeaderId** = false
*
* ```html
* <h1 id="thisisaheader">This is a header</h1>
* ```
*
* **noHeaderId** = true
*
* ```html
* <h1>This is a header</h1>
* ```
* @default false
* @since 1.1.0
*/

@@ -108,3 +252,8 @@ noHeaderId?: boolean;

*
* @example
* ```md
* ## Sample header {real-id} will use real-id as id
* ```
* @default false
* @since 1.7.0
*/

@@ -117,3 +266,22 @@ customizedHeaderId?: boolean;

*
* @example
* **input**:
*
* ```md
* # This is a header with @#$%
* ```
*
* **ghCompatibleHeaderId** = false
*
* ```html
* <h1 id="thisisaheader">This is a header</h1>
* ```
*
* **ghCompatibleHeaderId** = true
*
* ```html
* <h1 id="this-is-a-header-with-">This is a header with @#$%</h1>
* ```
* @default false
* @since 1.5.5
*/

@@ -128,2 +296,3 @@ ghCompatibleHeaderId?: boolean;

* @default false
* @since 1.0.0
*/

@@ -133,11 +302,33 @@ prefixHeaderId?: string | boolean;

/**
* Enable support for setting image dimensions from within markdown syntax.
* Examples:
* Setting this option to true will prevent showdown from modifying the prefix.
* This might result in malformed IDs (if, for instance, the " char is used in the prefix).
* Has no effect if prefixHeaderId is set to false.
*
* ![foo](foo.jpg =100x80) simple, assumes units are in px
* ![bar](bar.jpg =100x*) sets the height to "auto"
* ![baz](baz.jpg =80%x5em) Image with width of 80% and height of 5em
* @default false
* @since 1.7.3
*/
rawPrefixHeaderId?: boolean;
/**
* Remove only spaces, ' and " from generated header ids (including prefixes),
* replacing them with dashes (-).
* WARNING: This might result in malformed ids.
*
* @default false
* @since 1.7.3
*/
rawHeaderId?: boolean;
/**
* Enable support for setting image dimensions from within markdown syntax.
*
* @example
* ```md
* ![foo](foo.jpg =100x80) simple, assumes units are in px
* ![bar](bar.jpg =100x*) sets the height to "auto"
* ![baz](baz.jpg =80%x5em) Image with width of 80% and height of 5em
* ```
* @default false
* @since 1.1.0
*/
parseImgDimensions?: boolean;

@@ -147,10 +338,23 @@

* Set the header starting level. For instance, setting this to 3 means that
*
* @example
* **input**:
*
* # foo
* ```md
* # header
* ```
*
* will be parsed as
* **headerLevelStart** = 1
*
* <h3>foo</h3>
* ```html
* <h1>header</h1>
* ```
*
* **headerLevelStart** = 3
*
* ```html
* <h3>header</h3>
* ```
* @default 1
* @since 1.1.0
*/

@@ -162,3 +366,22 @@ headerLevelStart?: number;

*
* @example
* **input**:
*
* ```md
* some text www.google.com
* ```
*
* **simplifiedAutoLink** = false
*
* ```html
* <p>some text www.google.com</p>
* ```
*
* **simplifiedAutoLink** = true
*
* ```html
* <p>some text <a href="www.google.com">www.google.com</a></p>
* ```
* @default false
* @since 1.2.0
*/

@@ -168,6 +391,28 @@ simplifiedAutoLink?: boolean;

/**
* @deprecated https://github.com/showdownjs/showdown/commit/d3ebff7ef0cde5abfc3874463946d5297fc82e78
*
* This option excludes trailing punctuation from autolinking urls.
* Punctuation excluded: . ! ? ( ). Only applies if simplifiedAutoLink option is set to true.
* Punctuation excluded: . ! ? ( ).
*
* @remarks This option only applies to links generated by {@link Showdown.ShowdownOptions.simplifiedAutoLink}.
* @example
* **input**:
*
* ```md
* check this link www.google.com.
* ```
*
* **excludeTrailingPunctuationFromURLs** = false
*
* ```html
* <p>check this link <a href="www.google.com">www.google.com.</a></p>
* ```
*
* **excludeTrailingPunctuationFromURLs** = true
*
* ```html
* <p>check this link <a href="www.google.com">www.google.com</a>.</p>
* ```
* @default false
* @since 1.5.1
*/

@@ -180,11 +425,22 @@ excludeTrailingPunctuationFromURLs?: boolean;

*
* Example:
* @example
* **input**:
*
* some text with__underscores__in middle
* ```md
* some text with__underscores__in middle
* ```
*
* will be parsed as
* **literalMidWordUnderscores** = false
*
* <p>some text with__underscores__in middle</p>
* ```html
* <p>some text with<strong>underscores</strong>in middle</p>
* ```
*
* **literalMidWordUnderscores** = true
*
* ```html
* <p>some text with__underscores__in middle</p>
* ```
* @default false
* @since 1.2.0
*/

@@ -195,5 +451,15 @@ literalMidWordUnderscores?: boolean;

* Enable support for strikethrough syntax.
* `~~strikethrough~~` as `<del>strikethrough</del>`.
*
* @example
* **syntax**:
*
* ```md
* ~~strikethrough~~
* ```
*
* ```html
* <del>strikethrough</del>
* ```
* @default false
* @since 1.2.0
*/

@@ -203,12 +469,15 @@ strikethrough?: boolean;

/**
* Enable support for tables syntax. Example:
* Enable support for tables syntax.
*
* | h1 | h2 | h3 |
* |:------|:-------:|--------:|
* | 100 | [a][1] | ![b][2] |
* | *foo* | **bar** | ~~baz~~ |
* @example
* **syntax**:
*
* See the wiki for more info
*
* ```md
* | h1 | h2 | h3 |
* |:------|:-------:|--------:|
* | 100 | [a][1] | ![b][2] |
* | *foo* | **bar** | ~~baz~~ |
* ```
* @default false
* @since 1.2.0
*/

@@ -220,3 +489,5 @@ tables?: boolean;

*
* @remarks This options only applies if **[tables][]** is enabled.
* @default false
* @since 1.2.0
*/

@@ -226,5 +497,12 @@ tablesHeaderId?: boolean;

/**
* Enable support for GFM code block style.
* Enable support for GFM code block style syntax (fenced codeblocks).
*
* @example
* **syntax**:
*
* ```md
* some code here
* ```
* @default true
* @since 1.2.0
*/

@@ -234,8 +512,13 @@ ghCodeBlocks?: boolean;

/**
* Enable support for GFM takslists. Example:
* Enable support for GFM takslists.
*
* - [x] This task is done
* - [ ] This is still pending
* @example
* **syntax**:
*
* ```md
* - [x] This task is done
* - [ ] This is still pending
* ```
* @default false
* @since 1.2.0
*/

@@ -246,3 +529,6 @@ tasklists?: boolean;

* Prevents weird effects in live previews due to incomplete input.
*
*
* @example
* ![awkward effect](http://i.imgur.com/YQ9iHTL.gif)
* You can prevent this by enabling this option.
* @default false

@@ -257,2 +543,3 @@ */

* @default false
* @since 1.4.2
*/

@@ -265,3 +552,53 @@ smartIndentationFix?: boolean;

*
* @example
* **input**:
*
* ```md
* - one
* - two
*
* ...
*
* - one
* - two
* ```
*
* **disableForced4SpacesIndentedSublists** = false
*
* ```html
* <ul>
* <li>one</li>
* <li>two</li>
* </ul>
* <p>...</p>
* <ul>
* <li>one
* <ul>
* <li>two</li>
* </ul>
* </li>
* </ul>
* ```
*
* **disableForced4SpacesIndentedSublists** = true
*
* ```html
* <ul>
* <li>one
* <ul>
* <li>two</li>
* </ul>
* </li>
* </ul>
* <p>...</p>
* <ul>
* <li>one
* <ul>
* <li>two</li>
* </ul>
* </li>
* </ul>
* ```
* @default false
* @since 1.5.0
*/

@@ -273,3 +610,25 @@ disableForced4SpacesIndentedSublists?: boolean;

*
* @example
* **input**:
*
* ```md
* a line
* wrapped in two
* ```
*
* **simpleLineBreaks** = false
*
* ```html
* <p>a line
* wrapped in two</p>
* ```
*
* **simpleLineBreaks** = true
*
* ```html
* <p>a line<br>
* wrapped in two</p>
* ```
* @default false
* @since 1.5.1
*/

@@ -281,3 +640,23 @@ simpleLineBreaks?: boolean;

*
* @example
* **input**:
*
* ```md
* #header
* ```
*
* **requireSpaceBeforeHeadingText** = false
*
* ```html
* <h1 id="header">header</h1>
* ```
*
* **simpleLineBreaks** = true
*
* ```html
* <p>#header</p>
* ```
*
* @default false
* @since 1.5.3
*/

@@ -287,5 +666,24 @@ requireSpaceBeforeHeadingText?: boolean;

/**
* Enables github @mentions, which link to the username mentioned
* Enables support for github @mentions, which links to the github profile page of the username mentioned.
*
* @example
* **input**:
*
* ```md
* hello there @tivie
* ```
*
* **ghMentions** = false
*
* ```html
* <p>hello there @tivie</p>
* ```
*
* **ghMentions** = true
*
* ```html
* <p>hello there <a href="https://www.github.com/tivie>@tivie</a></p>
* ```
* @default false
* @since 1.6.0
*/

@@ -295,8 +693,24 @@ ghMentions?: boolean;

/**
* Changes the link generated by @mentions. Showdown will replace {u}
* with the username. Only applies if ghMentions option is enabled.
* Example: @tivie with ghMentionsOption set to //mysite.com/{u}/profile will
* result in <a href="//mysite.com/tivie/profile">@tivie</a>
* Changes the link generated by @mentions. `{u}` is replaced by the text of the mentions. Only applies if **[ghMentions][]** is enabled.
*
* @example
* **input**:
*
* ```md
* hello there @tivie
* ```
*
* **ghMentionsLink** = https://github.com/{u}
*
* ```html
* <p>hello there <a href="https://www.github.com/tivie>@tivie</a></p>
* ```
*
* **ghMentionsLink** = http://mysite.com/{u}/profile
*
* ```html
* <p>hello there <a href="//mysite.com/tivie/profile">@tivie</a></p>
* ```
* @default https://github.com/{u}
* @since 1.6.2
*/

@@ -306,5 +720,49 @@ ghMentionsLink?: string;

/**
* Enables e-mail addresses encoding through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities.
*
* @remarks Prior to version 1.6.1, emails would always be obfuscated through dec and hex encoding.
* @example
* **input**:
*
* ```
* <myself@example.com>
* ```
*
* **encodeEmails** = false
*
* ```html
* <a href="mailto:myself@example.com">myself@example.com</a>
* ```
*
* **encodeEmails** = true
*
* ```html
* <a href="&#109;&#97;&#105;&#108;t&#x6f;&#x3a;&#109;&#x79;s&#x65;&#x6c;&#102;&#64;&#x65;xa&#109;&#112;&#108;&#101;&#x2e;c&#x6f;&#109;">&#x6d;&#121;s&#101;&#108;f&#x40;&#x65;&#120;a&#x6d;&#x70;&#108;&#x65;&#x2e;&#99;&#x6f;&#109;</a>
* ```
* @default true
* @since 1.6.1
*/
encodeEmails?: boolean;
/**
* Open all links in new windows (by adding the attribute target="_blank" to <a> tags).
*
* @example
* **input**:
*
* ```md
* [Showdown](http://showdownjs.com)
* ```
*
* **openLinksInNewWindow** = false
* ```html
* <p><a href="http://showdownjs.com">Showdown</a></p>
* ```
*
* **openLinksInNewWindow** = true
* ```html
* <p><a href="http://showdownjs.com" target="_blank">Showdown</a></p>
* ```
* @default false
* @since 1.7.0
*/

@@ -314,5 +772,22 @@ openLinksInNewWindow?: boolean;

/**
* Support for HTML Tag escaping. ex: \<div>foo\</div>.
* Support for HTML Tag escaping.
*
* @example
* **input**:
*
* ```md
* \<div>foo\</div>.
* ```
*
* **backslashEscapesHTMLTags** = false
* ```html
* <p>\<div>foo\</div></p>
* ```
*
* **backslashEscapesHTMLTags** = true
* ```html
* <p>&lt;div&gt;foo&lt;/div&gt;</p>
* ```
* @default false
* @since 1.7.2
*/

@@ -322,5 +797,11 @@ backslashEscapesHTMLTags?: boolean;

/**
* Enable emoji support. Ex: `this is a :smile: emoji.
*
* Enable emoji support.
*
* @example
* ```md
* this is a :smile: emoji
* ```
* @default false
* @see https://github.com/showdownjs/showdown/wiki/Emojis
* @since 1.8.0
*/

@@ -333,3 +814,20 @@ emoji?: boolean;

*
* @example
* **input**:
*
* ```md
* __underline word__
* ```
*
* **underline** = false
* ```html
* <p><strong>underlined word</strong></p>
* ```
*
* **underline** = true
* ```html
* <p><u>underlined word</u></p>
* ```
* @default false
* @since 1.8.0
*/

@@ -339,5 +837,30 @@ underline?: boolean;

/**
* Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags
* Outputs a complete html document, including <html>, <head> and <body> tags' instead of an HTML fragment.
*
* @example
* **input**:
*
* ```md
* # Showdown
* ```
*
* **completeHTMLDocument** = false
* ```html
* <p><strong>Showdown</strong></p>
* ```
*
* **completeHTMLDocument** = true
* ```html
* <!DOCTYPE HTML>
* <html>
* <head>
* <meta charset="utf-8">
* </head>
* <body>
* <p><strong>Showdown</strong></p>
* </body>
* </html>
* ```
* @default false
* @since 1.8.5
*/

@@ -347,5 +870,13 @@ completeHTMLDocument?: boolean;

/**
* Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags
*
* Enable support for document metadata (defined at the top of the document
* between `«««` and `»»»` or between `---` and `---`).
*
* @example
* ```js
* var conv = new showdown.Converter({metadata: true});
* var html = conv.makeHtml(someMd);
* var metadata = conv.getMetadata(); // returns an object with the document metadata
* ```
* @default false
* @since 1.8.5
*/

@@ -355,8 +886,12 @@ metadata?: boolean;

/**
* Split adjacent blockquote blocks
* Split adjacent blockquote blocks.
*
* @default false
* @since 1.8.6
*/
splitAdjacentBlockquotes?: boolean;
/**
* For custom options {extension, subParser} And also an out-of-date definitions
*/
[key:string]: any;
}

@@ -367,18 +902,84 @@

extensions?: string | string[];
/**
* Add extensions to the new converter can be showdown extensions or "global" extensions name.
*/
extensions?: ((() => ShowdownExtension[] | ShowdownExtension) | ShowdownExtension[] | ShowdownExtension | string)[];
}
/**
* Showdown Flavor names.
*/
type Flavor = 'github' | 'original' | 'ghost' | 'vanilla' | 'allOn';
/**
* Showdown option description.
*/
interface ShowdownOptionDescription {
/**
* The default value of option.
*/
defaultValue?: boolean;
/**
* The description of the option.
*/
description?: string;
/**
* The type of the option value.
*/
type?: 'boolean' | 'string' | 'integer'
}
/**
* Showdown options schema.
*/
interface ShowdownOptionsSchema {
[key: string]: ShowdownOptionDescription;
}
/**
* Showdown subParser.
*/
type SubParser = (...args: any[]) => string;
/**
* Showdown Converter prototype.
*
* @see https://github.com/showdownjs/showdown/blob/master/src/converter.js
*/
interface Converter {
/**
* @param text The input text (markdown)
* @return The output HTML
* Listen to an event.
*
* @param name - The event name.
* @param callback - The function that will be called when the event occurs.
* @throws Throws if the type of `name` is not string.
* @throws Throws if the type of `callback` is not function.
* @example
* ```ts
* let converter: Converter = new Converter();
* converter
* .listen('hashBlock.before', (evtName, text, converter, options, globals) => {
* // ... do stuff to text ...
* return text;
* })
* .makeHtml('...');
* ```
*/
listen(name: string, callback: EventListener): Converter;
/**
* Converts a markdown string into HTML string.
*
* @param text - The input text (markdown).
* @return The output HTML.
*/
makeHtml(text: string): string;
/**
* Converts an HTML string into a markdown string
* Converts an HTML string into a markdown string.
*
* @param src The input text (HTML)
* @param src - The input text (HTML)
* @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
* @returns The output markdown
* @returns The output markdown.
*/

@@ -390,6 +991,6 @@ makeMarkdown(src: string, HTMLParser?: HTMLDocument): string;

*
* @param optionKey
* @param value
* @param key - The key of the option.
* @param value - The value of the option.
*/
setOption(optionKey: string, value: any): void;
setOption(key: string, value: any): void;

@@ -399,8 +1000,11 @@ /**

*
* @param optionKey
* @param key - The key of the option.
* @returns Returns the value of the given `key`.
*/
getOption(optionKey: string): any;
getOption(key: string): any;
/**
* Get the options of this Converter instance.
*
* @returns Returns the current convertor options object.
*/

@@ -412,12 +1016,11 @@ getOptions(): ShowdownOptions;

*
* @param extension
* @param name
* @param extension - The new extension to add.
* @param name - The extension name.
*/
addExtension(extension: ShowdownExtension, name: string): void;
addExtension(extension: ShowdownExtension[], name: string): void;
addExtension(extension: (() => ShowdownExtension[] | ShowdownExtension) | ShowdownExtension[] | ShowdownExtension, name?: string): void;
/**
* Use a global registered extension with THIS converter
* Use a global registered extension with THIS converter.
*
* @param extensionName Name of the previously registered extension.
* @param extensionName - Name of the previously registered extension.
*/

@@ -427,15 +1030,21 @@ useExtension(extensionName: string): void;

/**
* Get all extensions.
* Set a "local" flavor for THIS Converter instance.
*
* @return all extensions.
* @param flavor - The flavor name.
*/
getAllExtensions(): ConverterExtensions;
setFlavor(name: Flavor): void;
/**
* Get the "local" currently set flavor of this converter.
*
* @returns Returns string flavor name.
*/
getFlavor(): Flavor;
/**
* Remove an extension from THIS converter.
*
* Note: This is a costly operation. It's better to initialize a new converter
* @remarks This is a costly operation. It's better to initialize a new converter.
* and specify the extensions you wish to use.
*
* @param extensions
* @param extensions - The extensions to remove.
*/

@@ -445,12 +1054,13 @@ removeExtension(extensions: ShowdownExtension[] | ShowdownExtension): void;

/**
* Set a "local" flavor for THIS Converter instance
* Get all extensions.
*
* @param flavor name
* @return all extensions.
*/
setFlavor(name: 'github' | 'original' | 'ghost' | 'vanilla' | 'allOn'): void;
getAllExtensions(): ConverterExtensions;
/**
* Get the metadata of the previously parsed document
* @param raw
* @returns {string|{}}
* Get the metadata of the previously parsed document.
*
* @param raw - If to returns Row or Metadata.
* @returns Returns Row if `row` is `true`, otherwise Metadata.
*/

@@ -460,4 +1070,5 @@ getMetadata(raw?: boolean): string | Metadata

/**
* Get the metadata format of the previously parsed document
* @returns {string}
* Get the metadata format of the previously parsed document.
*
* @returns Returns the metadata format.
*/

@@ -471,6 +1082,7 @@ getMetadataFormat(): string;

* @constructor
* @param converterOptions Configuration object, describes which extensions to apply
* @param converterOptions - Configuration object, describes which extensions to apply.
*/
new (converterOptions?: ConverterOptions): Converter;
new(converterOptions?: ConverterOptions): Converter;
}
/**

@@ -481,9 +1093,12 @@ * Helper Interface

replaceRecursiveRegExp(...args: any[]): string;
[key: string]: (...args: any[]) => any;
}
/** Constructor function for a Converter */
/**
* Constructor function for a Converter.
*/
var Converter: ConverterStatic;
/**
* Showdown helper
* Showdown helper.
*/

@@ -493,17 +1108,26 @@ var helper: Helper;

/**
* Setting a "global" option affects all instances of showdown
* Showdown extensions.
*/
var extensions: ShowdownExtensions;
/**
* Setting a "global" option affects all instances of showdown.
*
* @param optionKey
* @param value
* @param key - the option key.
* @param value - the option value.
*/
function setOption(optionKey: string, value: any): void;
function setOption(key: string, value: any): typeof Showdown;
/**
* Retrieve previous set global option.
* @param optionKey
* Get a "global" option.
*
* @param key - the option key.
* @returns Returns the value of the given `key`.
*/
function getOption(optionKey: string): any;
function getOption(key: string): any;
/**
* Retrieve previous set global options.
* Get the "global" options.
*
* @returns Returns a options object.
*/

@@ -513,3 +1137,3 @@ function getOptions(): ShowdownOptions;

/**
* Reset options.
* Reset "global" options to the default values.
*/

@@ -519,50 +1143,75 @@ function resetOptions(): void;

/**
* Retrieve the default options.
* Setting a "global" flavor affects all instances of showdown.
*
* @param name - The flavor name.
*/
function getDefaultOptions(): ShowdownOptions;
function setFlavor(name: Flavor): void;
/**
* Registered extensions
/**
* Get the "global" currently set flavor.
*
* @prarm name
* @param extenstion
* @returns Returns string flavor name.
*/
function extension(name: string, extension: (() => ShowdownExtension) | (() => ShowdownExtension[]) | ShowdownExtension): void;
function getFlavor(): Flavor;
/**
* @return The extensions array.
* Get the options of a specified flavor. Returns undefined if the flavor was not found.
*
* @param name - Name of the flavor.
* @returns Returns options object of the given flavor `name`.
*/
function getOption(optionKey: string): any;
function getFlavorOptions(name: Flavor): ShowdownOptions | undefined;
var extensions: { [name: string]: ShowdownExtension };
/**
* Retrieve previous set global options.
* Get the default options.
*
* @param [simple=true] - If to returns the default showdown options or the showdown options schema.
* @returns Returns the options schema if `simple` is `false`, otherwise the default showdown options.
*/
function getOptions(): ShowdownOptions;
function getDefaultOptions(simple?: boolean): ShowdownOptionsSchema | ShowdownOptions;
/**
* Retrieve the default options.
* Get a registered subParser.
*
* @param name - The parser name.
* @returns Returns the parser of the given `name`.
* @throws Throws if `name` is not of type string.
* @throws Throws if the parser is not exists.
*/
function getDefaultOptions(): ShowdownOptions;
function subParser(name: string): SubParser;
/**
* @param obj An array of items
* @param extenstion
* Register a subParser.
*
* @param name - The name of the new parser.
* @param func - The handler function of the new parser.
* @throws Throws if `name` is not of type string.
*/
function extension(name: string, extension: (() => ShowdownExtension) | (() => ShowdownExtension[]) | ShowdownExtension): void;
function subParser(name: string, func: SubParser): void;
/**
* Get an extension.
* Get a registered extension.
*
* @param name
* @return The extensions array.
* @param name - The extension name.
* @returns Returns the extension of the given `name`.
* @throws Throws if `name` is not of type string.
* @throws Throws if the extension is not exists.
*/
function extension(name: string): ShowdownExtension[];
/**
* Register a extension.
*
* @param name - The name of the new extension.
* @param ext - The extension.
* @throws Throws if `name` is not of type string.
*/
function extension(name: string, ext: (() => ShowdownExtension[] | ShowdownExtension) | ShowdownExtension[] | ShowdownExtension): void;
function resetExtensions(): void;
/**
* @return all extensions.
* Get the "global" extensions.
*
* @return Returns all extensions.
*/
function getAllExtensions(): { [name: string]: ShowdownExtension[] };
function getAllExtensions(): ShowdownExtensions;

@@ -572,3 +1221,3 @@ /**

*
* @param name
* @param name - The extension name.
*/

@@ -578,3 +1227,3 @@ function removeExtension(name: string): void;

/**
* Reset extensions.
* Removes all extensions.
*/

@@ -584,7 +1233,8 @@ function resetExtensions(): void;

/**
* Setting a "global" flavor affects all instances of showdown
* Checks if the given `ext` is a valid showdown extension.
*
* @param name
* @param ext - The extension to checks.
* @returns Returns `true` if the extension is valid showdown extension, otherwise `false`.
*/
function setFlavor(name: 'github' | 'original' | 'ghost' | 'vanilla' | 'allOn'): void;
function validateExtension(ext: ShowdownExtension[] | ShowdownExtension): boolean;
}

12

showdown/package.json
{
"name": "@types/showdown",
"version": "1.9.2",
"version": "1.9.3",
"description": "TypeScript definitions for Showdown",

@@ -26,2 +26,7 @@ "license": "MIT",

"githubUsername": "arielsaldana"
},
{
"name": "Yisrael Eliav",
"url": "https://github.com/yisraelx",
"githubUsername": "yisraelx"
}

@@ -33,8 +38,9 @@ ],

"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/showdown"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "81aa18ff05de4767b9af3c20b38eaa4c133028e2ba060a859f110d9761c91e04",
"typesPublisherContentHash": "6a962e2c0d228b7f443c8d72f07eb44f364e5b5d24de4422b8d33088568acf5a",
"typeScriptVersion": "2.0"
}

@@ -5,3 +5,3 @@ # Installation

# Summary
This package contains type definitions for Showdown (https://github.com/showdownjs/showdown).
This package contains type definitions for Showdown ( https://github.com/showdownjs/showdown ).

@@ -12,3 +12,3 @@ # Details

Additional Details
* Last updated: Mon, 14 Jan 2019 22:37:28 GMT
* Last updated: Mon, 13 May 2019 16:48:49 GMT
* Dependencies: none

@@ -18,2 +18,2 @@ * Global values: showdown

# Credits
These definitions were written by Hamed Baatour <https://github.com/hamedbaatour>, cbowdon <https://github.com/cbowdon>, Pei-Tang Huang <https://github.com/tan9>, Ariel-Saldana <https://github.com/arielsaldana>.
These definitions were written by Hamed Baatour <https://github.com/hamedbaatour>, cbowdon <https://github.com/cbowdon>, Pei-Tang Huang <https://github.com/tan9>, Ariel-Saldana <https://github.com/arielsaldana>, Yisrael Eliav <https://github.com/yisraelx>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc