Merge pull request #31270 from donatj/fix/ShowdownMakeMarkdown

Adds missing makeMarkdown to Showdown
This commit is contained in:
Nathan Shively-Sanders
2018-12-18 15:33:07 -08:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+9 -1
View File
@@ -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 <https://github.com/cbowdon>, Pei-Tang Huang <https://github.com/tan9>, Ariel-Saldana <https://github.com/arielsaldana>
// 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.
*
+4
View File
@@ -6,6 +6,7 @@
import showdown = require('showdown');
var exampleMarkdown = '#hello, markdown',
exampleHTML = '<h1>hello, markdown</h1>',
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 '<p>*hello, markdown</p>'
console.log(converter.makeMarkdown(exampleHTML));
// should log '#hello, markdown'
showdown.extension('myExt', function () {
var matches: string[] = [];
return [