diff --git a/CHANGELOG.md b/CHANGELOG.md index fe8e425..7732d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +### Fixed +- Correct textile-js typescript definition + + ## [1.3.25] - 20231124 ### Changed diff --git a/libs/textile-js/textile.d.ts b/libs/textile-js/textile.d.ts index e161f43..90e475d 100644 --- a/libs/textile-js/textile.d.ts +++ b/libs/textile-js/textile.d.ts @@ -2,8 +2,6 @@ // Project: https://github.com/GehDoc/textile-js/ // Definitions by: GĂ©rald Hameau -export = TextileJS; - declare namespace TextileJS { type Token = any; @@ -22,18 +20,22 @@ declare namespace TextileJS { renderers?: Renderer[], dontEscapeContentForTags? :string[], }; +} + +interface TextileJS { + convert(text: string, options?: TextileJS.Options, context?: any): string; + setOptions(options: TextileJS.Options): object; - interface TextileJS { - convert(text: string, options?: Options, context?: any): string; - setOptions(options: Options): object; + tokenize(text: string, options?: TextileJS.Options, context?: any): TextileJS.Token[]; + serialize(tokens: TextileJS.Token[], options?: TextileJS.Options, context?: any): string; - tokenize(text: string, options?: Options, context?: any): Token[]; - serialize(tokens: Token[], options?: Options, context?: any): string; + jsonmlUtils: { + applyHooks(jsonml: TextileJS.Token[], hooks: TextileJS.Hook[], nodeLevel?: number, context?: any): TextileJS.Token[]; + addAttributes(jsonml: TextileJS.Token[], newAttr: TextileJS.jsonmlAttributes): TextileJS.jsonmlAttributes; + escape(text: string, escapeQuotes?: boolean): string; + }; +} + +declare const TextileJS: TextileJS; - jsonmlUtils: { - applyHooks(jsonml: Token[], hooks: Hook[], nodeLevel?: number, context?: any): Token[]; - addAttributes(jsonml: Token[], newAttr: jsonmlAttributes): jsonmlAttributes; - escape(text: string, escapeQuotes?: boolean): string; - }; - } -} \ No newline at end of file +export = TextileJS; diff --git a/src/textileEngine.ts b/src/textileEngine.ts index 4da911d..a050011 100644 --- a/src/textileEngine.ts +++ b/src/textileEngine.ts @@ -3,7 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { type TextileJS, type Token, Options as TextileJSConfig } from '../libs/textile-js/textile'; +import TextileJS = require('../libs/textile-js/textile'); +import { type Token, Options as TextileJSConfig } from '../libs/textile-js/textile'; import * as vscode from 'vscode'; import { ILogger } from './logging'; import { TextileContributionProvider } from './textileExtensions';