@diplodoc/transform 4.62.0 → 4.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/_yfm-only.css +2 -2
- package/dist/css/_yfm-only.css.map +3 -3
- package/dist/css/_yfm-only.min.css +1 -1
- package/dist/css/_yfm-only.min.css.map +3 -3
- package/dist/css/base.css.map +1 -1
- package/dist/css/base.min.css.map +1 -1
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css +2 -2
- package/dist/css/yfm.css.map +3 -3
- package/dist/css/yfm.min.css +1 -1
- package/dist/css/yfm.min.css.map +3 -3
- package/dist/js/base.js +55 -14
- package/dist/js/base.js.map +2 -2
- package/dist/js/base.min.js +6 -1
- package/dist/js/base.min.js.map +3 -3
- package/dist/js/yfm.js +55 -14
- package/dist/js/yfm.js.map +2 -2
- package/dist/js/yfm.min.js +6 -1
- package/dist/js/yfm.min.js.map +3 -3
- package/lib/liquid/index.js.map +1 -1
- package/lib/plugins/images/index.d.ts +7 -1
- package/lib/plugins/images/index.js +49 -19
- package/lib/plugins/images/index.js.map +1 -1
- package/lib/plugins/imsize/const.d.ts +2 -1
- package/lib/plugins/imsize/const.js +1 -0
- package/lib/plugins/imsize/const.js.map +1 -1
- package/lib/plugins/imsize/plugin.js +35 -0
- package/lib/plugins/imsize/plugin.js.map +1 -1
- package/lib/plugins/inline-code/constant.d.ts +0 -1
- package/lib/plugins/inline-code/constant.js +1 -19
- package/lib/plugins/inline-code/constant.js.map +1 -1
- package/lib/plugins/inline-code/index.js +0 -30
- package/lib/plugins/inline-code/index.js.map +1 -1
- package/lib/typings.d.ts +5 -0
- package/package.json +1 -1
- package/src/js/inline-code/constant.ts +25 -0
- package/src/js/inline-code/utils.ts +42 -15
- package/src/scss/_inline-code.scss +2 -2
- package/src/transform/liquid/index.ts +2 -2
- package/src/transform/plugins/images/index.ts +63 -23
- package/src/transform/plugins/imsize/const.ts +1 -0
- package/src/transform/plugins/imsize/plugin.ts +42 -0
- package/src/transform/plugins/inline-code/constant.ts +0 -19
- package/src/transform/plugins/inline-code/index.ts +2 -41
- package/src/transform/typings.ts +6 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {MarkdownItPluginCb
|
|
1
|
+
import type {MarkdownItPluginCb} from '../../typings';
|
|
2
2
|
|
|
3
3
|
import {escapeHtml} from 'markdown-it/lib/common/utils';
|
|
4
4
|
|
|
5
5
|
import {generateID} from '../utils';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {LANG_TOKEN_DESCRIPTION, LANG_TOKEN_LABEL} from './constant';
|
|
8
8
|
|
|
9
9
|
const inlineCode: MarkdownItPluginCb = (md, options) => {
|
|
10
10
|
const lang = options.lang;
|
|
@@ -17,45 +17,6 @@ const inlineCode: MarkdownItPluginCb = (md, options) => {
|
|
|
17
17
|
|
|
18
18
|
return `<code class="yfm-clipboard-inline-code" role="button" aria-label="${label}" aria-description="${description}" tabindex='0' id="inline-code-id-${id}">${escapeHtml(tokens[idx].content)}</code>`;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
md.core.ruler.after('inline', 'tooltip_code_inline', (state: StateCore) => {
|
|
22
|
-
const tokens = state.tokens;
|
|
23
|
-
|
|
24
|
-
for (let i = 0; i !== tokens.length; i++) {
|
|
25
|
-
const token = tokens[i];
|
|
26
|
-
|
|
27
|
-
if (token.type !== 'inline') {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (!token.children || token.children.every((e) => e.type !== 'code_inline')) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const child = token.children.find((e) => e.type === 'code_inline');
|
|
36
|
-
|
|
37
|
-
if (!child) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const dialog = new state.Token('tooltip_open', 'div', 1);
|
|
42
|
-
dialog.attrSet('class', 'yfm inline_code_tooltip');
|
|
43
|
-
dialog.attrSet('id', `tooltip_inline_clipboard_dialog`);
|
|
44
|
-
dialog.attrSet('role', 'dialog');
|
|
45
|
-
dialog.attrSet('aria-live', 'polite');
|
|
46
|
-
dialog.attrSet('aria-modal', 'true');
|
|
47
|
-
|
|
48
|
-
tokens.push(dialog);
|
|
49
|
-
|
|
50
|
-
const text = new state.Token('text', '', 0);
|
|
51
|
-
text.content = LANG_TOKEN[lang] ?? LANG_TOKEN.en;
|
|
52
|
-
tokens.push(text);
|
|
53
|
-
|
|
54
|
-
const closeDialog = new state.Token('tooltip_close', 'div', -1);
|
|
55
|
-
tokens.push(closeDialog);
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
20
|
};
|
|
60
21
|
|
|
61
22
|
export = inlineCode;
|
package/src/transform/typings.ts
CHANGED
|
@@ -147,3 +147,9 @@ export type MarkdownItPreprocessorCb<T extends unknown = {}> = {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
export type CssWhiteList = {[property: string]: boolean};
|
|
150
|
+
|
|
151
|
+
export type ImageOptions = {
|
|
152
|
+
width: string | undefined | null;
|
|
153
|
+
height: string | undefined | null;
|
|
154
|
+
inline: boolean | undefined | null;
|
|
155
|
+
};
|