Skip to content

Commit 986edce

Browse files
committed
fix #37 ts declaration
1 parent 38e7c65 commit 986edce

File tree

3 files changed

+244
-1
lines changed

3 files changed

+244
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
"files": [
1818
"dist",
1919
"doc",
20-
"src"
20+
"src",
21+
"types"
2122
],
23+
"typings": "types/index.d.ts",
2224
"scripts": {
2325
"dev": "vue-cli-service serve ./example/main.js",
2426
"build": "npm run build:lib && npm run build:light && npm run build:example",

types/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { MarkdownItVue } from './markdown-it-vue'
2+
export declare class MarkdownItVueLight extends MarkdownItVue { }
3+
4+
export default MarkdownItVue

types/markdown-it-vue.d.ts

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
/**
2+
* The options of MarkdownIt.
3+
* https://markdown-it.github.io/markdown-it/#MarkdownIt.new
4+
*/
5+
export interface MarkdownItOptions {
6+
/** false.Set true to enable HTML tags in source.Be careful!
7+
* That's not safe! You may need external sanitizer to protect output from XSS.
8+
* It's better to extend features via plugins, instead of enabling HTML.
9+
*/
10+
html: boolean
11+
/**
12+
* false.Set true to add '/' when closing single tags(<br />).
13+
* This is needed only for full CommonMark compatibility.
14+
* In real world you will need HTML output.
15+
*/
16+
xhtmlOut: boolean
17+
/**
18+
* false.Set true to convert \n in paragraphs into<br>.
19+
*/
20+
breaks: boolean
21+
/**
22+
* language -.CSS language class prefix for fenced blocks.Can be useful for external highlighters.
23+
*/
24+
langPrefix: string
25+
/**
26+
* false.Set true to autoconvert URL - like text to links.
27+
*/
28+
linkify: boolean
29+
/**
30+
* false.Set true to enable some language - neutral replacement + quotes beautification(smartquotes).
31+
*/
32+
typographer: boolean
33+
/**
34+
* “”‘’, String or Array.Double + single quotes replacement pairs,
35+
* when typographer enabled and smartquotes on.For example, you can use '«»„“'
36+
* for Russian, '„“‚‘' for German, and['«\xA0', '\xA0»', '‹\xA0', '\xA0›']
37+
* for French(including nbsp).
38+
*/
39+
quotes: string | string[]
40+
/**
41+
* null.Highlighter function for fenced code blocks.
42+
* Highlighter function (str, lang) should return escaped HTML.
43+
* It can also return empty string if the source was not changed and should be escaped externaly.
44+
* If result starts with <pre...internal wrapper is skipped.
45+
*/
46+
highlight: ((str: string, lang: string) => string)
47+
}
48+
49+
export interface LinkAttributesOpionsAttrs {
50+
/**
51+
* The browser target like '_blank' etc.
52+
*/
53+
target: string
54+
/**
55+
* Special the rel attribute like 'noopener' etc.
56+
*/
57+
rel: string
58+
/**
59+
* Special the css class.
60+
*/
61+
class: string
62+
}
63+
64+
/**
65+
* The options of markdown-it-link-attributes
66+
* https://www.npmjs.com/package/markdown-it-link-attributes
67+
*/
68+
export interface LinkAttributesOpions {
69+
/**
70+
* You can also specify a pattern property.
71+
* The link's href property will be checked against the pattern RegExp provided
72+
* and only apply the attributes if it matches the pattern.
73+
*/
74+
pattern: RegExp
75+
attrs: LinkAttributesOpionsAttrs
76+
}
77+
78+
/**
79+
* The options of image.
80+
*/
81+
export interface ImageOptions {
82+
/**
83+
* The horizontal align of the images. 'left' or 'center' or 'right'.
84+
*/
85+
hAlign: string
86+
/**
87+
* True if show the image viewer.
88+
*/
89+
viewer: boolean
90+
}
91+
92+
/**
93+
* The options of katex.
94+
* https://www.npmjs.com/package/markdown-it-katex
95+
*/
96+
export interface KatexOptions {
97+
/**
98+
* True if throw on error.
99+
*/
100+
throwOnError: boolean
101+
/**
102+
* The error color default '#cc0000'
103+
*/
104+
errorColor: string
105+
}
106+
107+
/**
108+
* The options of tasklists.
109+
* https://www.npmjs.com/package/markdown-it-task-lists
110+
*/
111+
export interface TasklistsOptions {
112+
/**
113+
* The rendered checkboxes are disabled;
114+
* to change this, pass a truthy value into the enabled property of the plugin options.
115+
*/
116+
enabled: boolean
117+
/**
118+
* If you'd like to wrap the rendered list items in a <label> element for UX purposes,
119+
* pass a truthy value to the label property of the plugin options.
120+
*/
121+
label: boolean
122+
/**
123+
* To add the label after the checkbox pass a truthy value to labelAfter property.
124+
*/
125+
labelAfter: boolean
126+
}
127+
128+
/**
129+
* The options of githubToc
130+
* https://www.npmjs.com/package/markdown-it-github-tocmarkdown-it-github-toc
131+
*/
132+
export interface GithubTocOptions {
133+
/**
134+
* Allow you to enable / disable the toc transformation of[toc]
135+
* (default : true)
136+
*/
137+
toc: boolean
138+
/**
139+
* Option to customize html class of the < ul > wrapping the toc
140+
* (default : "markdownIt-TOC")
141+
*/
142+
tocClassName: string
143+
/**
144+
* Allow you to skip some heading level.Example: use 2 if you want to skip < h1 > from the TOC.
145+
* (default : 1)
146+
*/
147+
tocFirstLevel: number
148+
/**
149+
* Allow you to skip some heading level.Example: use 5 if you want to skip < h6 > from the TOC.
150+
* (default: 6)
151+
*/
152+
tocLastLevel: number
153+
/**
154+
* Allow you to enable / disable the anchor link in the headings
155+
* (default: true)
156+
*/
157+
anchorLink: boolean
158+
/**
159+
* Allow you to customize the anchor link symbol
160+
* (default: "#")
161+
*/
162+
anchorLinkSymbol: string
163+
/**
164+
* Allow you to enable / disable inserting a space between the anchor link and heading.
165+
* (default: true)
166+
*/
167+
anchorLinkSpace: boolean
168+
/**
169+
* Allow you to customize the anchor link symbol class name.If not null,
170+
* symbol will be rendered as <span class="anchorLinkSymbolClassName" > anchorLinkSymbol < /span>.
171+
* (default: null)
172+
*/
173+
anchorLinkSymbolClassName: string
174+
/**
175+
* Allow you to prepend / append the anchor link in the headings
176+
* (default: true)
177+
*/
178+
anchorLinkBefore: boolean
179+
/**
180+
* Allow you to customize the anchor link class
181+
* (default: "markdownIt-Anchor")
182+
*/
183+
anchorClassName: string
184+
/**
185+
* Allow you to reset(or not) ids incrementation.Use it if you will have multiple documents on the same page.
186+
* (default: true)
187+
*/
188+
resetIds: boolean
189+
/**
190+
* Allow you to customize indentation
191+
* (default: " ")
192+
*/
193+
indentation: string
194+
}
195+
196+
197+
export interface MarkdownItVueOptions {
198+
/**
199+
* The options of MarkdownIt.
200+
*/
201+
markdownIt: MarkdownItOptions
202+
/**
203+
* The options of markdown-it-link-attributes.
204+
* https://www.npmjs.com/package/markdown-it-link-attributes
205+
*/
206+
linkAttributes: LinkAttributesOpions
207+
/**
208+
* The options of katex.
209+
* https://www.npmjs.com/package/markdown-it-katex
210+
*/
211+
katex: KatexOptions
212+
/**
213+
* The options of tasklists.
214+
* https://www.npmjs.com/package/markdown-it-task-lists
215+
*/
216+
tasklists: TasklistsOptions
217+
/**
218+
* The options of githubToc
219+
* https://www.npmjs.com/package/markdown-it-github-tocmarkdown-it-github-toc
220+
*/
221+
githubToc: GithubTocOptions
222+
/**
223+
* The options of mermaid.
224+
* https://mermaid-js.github.io/mermaid/#/Setup?id=mermaidapi-configuration-defaults
225+
*/
226+
mermaid: object,
227+
/**
228+
* The options of ImageViewer.
229+
*/
230+
image: ImageOptions
231+
}
232+
233+
export declare class MarkdownItVue {
234+
/** markdown plain text */
235+
content: string
236+
options: MarkdownItVueOptions
237+
}

0 commit comments

Comments
 (0)