feat: add types for refractor

This commit is contained in:
Ifiok Jr
2019-04-14 12:42:16 +01:00
parent 6a5529e838
commit ab040c4ea5
181 changed files with 703 additions and 0 deletions

145
types/refractor/core.d.ts vendored Normal file
View File

@@ -0,0 +1,145 @@
import * as Prism from 'prismjs';
export interface RefractorSyntax {
displayName: string;
aliases: string[];
(prism: typeof Prism): void;
}
export namespace AST {
namespace Unist {
interface Node {
type: string;
}
interface Parent extends Node {
children: RefractorNode[];
}
interface Text extends Node {
value: string;
}
}
interface Properties {
className?: string[];
[key: string]: any;
}
interface Element extends Unist.Parent {
type: 'element';
tagName: string;
properties: Properties;
}
interface Text extends Unist.Text {
type: 'text';
}
}
export type RefractorNode = AST.Element | AST.Text;
/**
* Register a syntax. Needed if youre using refractor/core.js.
*
* ```ts
* import refractor = require('refractor/core')
* import markdown = require('refractor/lang/markdown')
*
* refractor.register(markdown)
* console.log(refractor.highlight('*Emphasis*', 'markdown'))
*
* // => [ { type: 'element', tagName: 'span', properties: [Object], children: [Array] } ]
* ```
*
* @param syntax
*/
export function register(syntax: RefractorSyntax): void;
/**
* Parse value (string) according to the language (name or alias) syntax.
*
* @returns Virtual nodes representing the highlighted value (Array.<Node>).
*
* ```ts
* import refractor = require('refractor/core')
* console.log(refractor.highlight('em { color: red }', 'css'))
* ```
*
* Yields:
*
* ```
* [
* { type: 'element',
* tagName: 'span',
* properties: [Object],
* children: [Array] },
* { type: 'text', value: ' ' },
* // ...
* { type: 'text', value: ' red ' },
* { type: 'element',
* tagName: 'span',
* properties: [Object],
* children: [Array] }
* ]
* ```
*/
export function highlight(value: string, name: string): RefractorNode[];
/**
* Check if a language (name or alias) is registered.
*
* ```ts
* import refractor = require('refractor/core')
* import markdown = require('refractor/lang/markdown')
*
* console.log(registered('markdown'))
*
* register(markdown)
*
* console.log(registered('markdown'))
*
* // => true | false
* ```
*/
export function registered(name: string): boolean;
/**
* List all registered languages (names and aliases).
*
* ```ts
* import refractor = require('refractor/core')
* import markdown = require('refractor/lang/markdown')
*
* console.log(refractor.listLanguages())
*
* refractor.register(markdown)
*
* console.log(refractor.listLanguages())
* ```
*
* Yields:
*
* ```
* [ 'markup',
* 'xml',
* 'html',
* 'mathml',
* 'svg',
* 'css',
* 'clike',
* 'javascript',
* 'js' ]
* [ 'markup',
* 'xml',
* 'html',
* 'mathml',
* 'svg',
* 'css',
* 'clike',
* 'javascript',
* 'js',
* 'markdown' ]
* ```
*/
export function listLanguages(): string[];

8
types/refractor/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for refractor 2.8
// Project: https://github.com/wooorm/refractor#readme
// Definitions by: Ifiok Jr. <https://github.com/ifiokjr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import refractor = require('./core');
export = refractor;

3
types/refractor/lang/abap.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/abnf.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/ada.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/apacheconf.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/apl.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/applescript.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/arduino.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/arff.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/asciidoc.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/asm6502.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/aspnet.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/autohotkey.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/autoit.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/bash.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/basic.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/batch.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/bison.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/bnf.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/brainfuck.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/bro.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/c.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/cil.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/clike.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/clojure.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/cmake.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/cpp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/crystal.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/csharp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/csp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/css-extras.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/css.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/d.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/dart.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/diff.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/django.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/docker.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/ebnf.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/eiffel.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/ejs.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/elixir.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/elm.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/erb.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/erlang.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/flow.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/fortran.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/fsharp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/gcode.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/gedcom.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/gherkin.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/git.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/glsl.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/gml.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/go.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/graphql.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/groovy.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/haml.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/handlebars.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/haskell.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/haxe.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/hcl.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/hpkp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/hsts.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/http.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/ichigojam.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/icon.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/inform7.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/ini.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/io.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/j.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/java.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/javadoc.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/javadoclike.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/javascript.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/jolie.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/js-extras.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/jsdoc.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/json.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/json5.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/jsonp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/jsx.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/julia.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/keyman.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/kotlin.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/latex.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/less.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/liquid.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/lisp.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/livescript.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/lolcode.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/lua.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/makefile.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/markdown.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/markup.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

3
types/refractor/lang/matlab.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import { RefractorSyntax } from '../core';
declare const lang: RefractorSyntax;
export = lang;

Some files were not shown because too many files have changed in this diff Show More