diff --git a/types/showdown/index.d.ts b/types/showdown/index.d.ts index 6e2b86cccc..21075fd6c7 100644 --- a/types/showdown/index.d.ts +++ b/types/showdown/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Showdown 1.7.3 +// Type definitions for Showdown 1.9.0 // Project: https://github.com/coreyti/showdown // Definitions by: cbowdon , Pei-Tang Huang , Ariel-Saldana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -294,6 +294,14 @@ declare namespace Showdown { */ makeHtml(text: string): string; + /** + * Converts an HTML string into a markdown string + * + * @param src The input text (HTML) + * @returns The output markdown + */ + makeMarkdown(src: string): string; + /** * Setting a "local" option only affects the specified Converter object. * diff --git a/types/showdown/showdown-tests.ts b/types/showdown/showdown-tests.ts index e31af905f7..0baf2f895f 100644 --- a/types/showdown/showdown-tests.ts +++ b/types/showdown/showdown-tests.ts @@ -6,6 +6,7 @@ import showdown = require('showdown'); var exampleMarkdown = '#hello, markdown', + exampleHTML = '

hello, markdown

', converter = new showdown.Converter(); var myExt: showdown.ShowdownExtension = { type: 'output', filter: (text, converter) => { return text.replace('#', '*') } }; @@ -34,6 +35,9 @@ console.log(configuredConverter.makeHtml(exampleMarkdown)); // should log '

*hello, markdown

' +console.log(converter.makeMarkdown(exampleHTML)); +// should log '#hello, markdown' + showdown.extension('myExt', function () { var matches: string[] = []; return [