mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge pull request #31270 from donatj/fix/ShowdownMakeMarkdown
Adds missing makeMarkdown to Showdown
This commit is contained in:
Vendored
+9
-1
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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 [
|
||||
|
||||
Reference in New Issue
Block a user