Skip to content

Commit

Permalink
Correct textile-js typescript definition
Browse files Browse the repository at this point in the history
  • Loading branch information
GehDoc committed Nov 26, 2023
1 parent b92e742 commit 0dad3e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 16 additions & 14 deletions libs/textile-js/textile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Project: https://github.com/GehDoc/textile-js/
// Definitions by: Gérald Hameau <https://github.com/GehDoc>

export = TextileJS;

declare namespace TextileJS {
type Token = any;

Expand All @@ -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;
};
}
}
export = TextileJS;
3 changes: 2 additions & 1 deletion src/textileEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 0dad3e4

Please sign in to comment.