From 0da14f6a5bd20ba88055fbcd162e79c6c13d6848 Mon Sep 17 00:00:00 2001 From: Ariel Saldana Date: Fri, 23 Feb 2018 10:00:58 -0500 Subject: [PATCH] Support for helper functions --- .github/CODEOWNERS | 2 +- types/showdown/index.d.ts | 15 +++++++++++++-- types/showdown/showdown-tests.ts | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a03915a264..8ce8955c37 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3379,7 +3379,7 @@ /types/shopify-buy/ @openminder /types/shortid/ @stpettersens @despairblue /types/shot/ @AJamesPhillips -/types/showdown/ @cbowdon @tan9 +/types/showdown/ @cbowdon @tan9 @arielsaldana /types/shrink-ray/ @forabi /types/siema/ @Irmiz @0x6368656174 @samnau /types/siesta/ @bquarmby diff --git a/types/showdown/index.d.ts b/types/showdown/index.d.ts index 3a1accb411..948fd966ec 100644 --- a/types/showdown/index.d.ts +++ b/types/showdown/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Showdown 1.7.2 +// Type definitions for Showdown 1.7.3 // Project: https://github.com/coreyti/showdown -// Definitions by: cbowdon , Pei-Tang Huang +// Definitions by: cbowdon , Pei-Tang Huang , Ariel-Saldana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Showdown; @@ -362,10 +362,21 @@ declare namespace Showdown { */ new (converterOptions?: ConverterOptions): Converter; } + /** + * Helper Interface + */ + interface Helper { + replaceRecursiveRegExp(...args: any[]): string; + } /** Constructor function for a Converter */ var Converter: ConverterStatic; + /** + * Showdown helper + */ + var helper: Helper; + /** * Setting a "global" option affects all instances of showdown */ diff --git a/types/showdown/showdown-tests.ts b/types/showdown/showdown-tests.ts index e0d9093bc1..09a04b920c 100644 --- a/types/showdown/showdown-tests.ts +++ b/types/showdown/showdown-tests.ts @@ -17,6 +17,8 @@ var preloadedExtensions = [ 'my-ext' ], var configuredConverter = new showdown.Converter(); configuredConverter.addExtension({type: 'output', filter: (text, converter)=>{return text.replace('#', '*')}}, 'myext'); +console.log(showdown.helper); + console.log(converter.makeHtml(exampleMarkdown)); // should log '

hello, markdown

'