@diplodoc/transform 4.45.1 → 4.45.3
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.map +1 -1
- package/dist/css/_yfm-only.min.css.map +1 -1
- package/dist/css/base.css +10 -7
- package/dist/css/base.css.map +3 -3
- package/dist/css/base.min.css +1 -1
- package/dist/css/base.min.css.map +3 -3
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css +10 -7
- 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/lib/plugins/images/collect.d.ts +2 -0
- package/lib/plugins/images/collect.js +2 -9
- package/lib/plugins/images/collect.js.map +1 -1
- package/package.json +2 -2
- package/src/scss/_common.scss +19 -16
- package/src/transform/plugins/images/collect.ts +4 -6
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Token } from 'markdown-it';
|
|
1
2
|
import { MarkdownItPluginOpts } from '../typings';
|
|
2
3
|
declare type Options = MarkdownItPluginOpts & {
|
|
3
4
|
destPath: string;
|
|
4
5
|
copyFile: (path: string, dest: string) => void;
|
|
5
6
|
singlePage: boolean;
|
|
7
|
+
tokenStream: Token[];
|
|
6
8
|
};
|
|
7
9
|
declare const collect: (input: string, options: Options) => string | null;
|
|
8
10
|
export = collect;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const markdown_it_1 = __importDefault(require("markdown-it"));
|
|
6
2
|
const path_1 = require("path");
|
|
7
3
|
const utils_1 = require("../../utils");
|
|
8
4
|
const utilsFS_1 = require("../../utilsFS");
|
|
9
|
-
const imsize_1 = __importDefault(require("../imsize"));
|
|
10
5
|
const collect = (input, options) => {
|
|
11
|
-
const
|
|
12
|
-
const { root, path, destPath = '', copyFile, singlePage } = options;
|
|
13
|
-
const tokens = md.parse(input, {});
|
|
6
|
+
const { root, path, destPath = '', copyFile, singlePage, tokenStream } = options;
|
|
14
7
|
let result = input;
|
|
15
|
-
|
|
8
|
+
tokenStream.forEach((token) => {
|
|
16
9
|
if (token.type !== 'inline') {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect.js","sourceRoot":"","sources":["../../../src/transform/plugins/images/collect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collect.js","sourceRoot":"","sources":["../../../src/transform/plugins/images/collect.ts"],"names":[],"mappings":";AACA,+BAA8B;AAE9B,uCAAuC;AACvC,2CAAkD;AAUlD,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,OAAgB,EAAE,EAAE;IAChD,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAC,GAAG,OAAO,CAAC;IAE/E,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YACzB,OAAO;SACV;QAED,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QAEtC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC5B,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC7B,OAAO;aACV;YAED,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAE5C,IAAI,CAAC,IAAA,kBAAU,EAAC,GAAG,CAAC,EAAE;gBAClB,OAAO;aACV;YAED,MAAM,UAAU,GAAG,IAAA,6BAAmB,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAClD,MAAM,cAAc,GAAG,IAAA,6BAAmB,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAE1D,IAAI,UAAU,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBAC5C,MAAM,MAAM,GAAG,IAAA,eAAQ,EAAC,IAAI,EAAE,IAAA,6BAAmB,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;gBAE9D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;aACxC;YAED,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE;QACZ,OAAO,MAAM,CAAC;KACjB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,iBAAS,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diplodoc/transform",
|
|
3
|
-
"version": "4.45.
|
|
3
|
+
"version": "4.45.3",
|
|
4
4
|
"description": "A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"lint:fix": "lint update && lint fix",
|
|
45
45
|
"pre-commit": "lint update && lint-staged",
|
|
46
46
|
"prepare": "husky",
|
|
47
|
-
"postinstall": "cd playground && npm ci --ignore-scripts"
|
|
47
|
+
"postinstall": "cd playground && npm ci --ignore-scripts || true"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@diplodoc/cut-extension": "^0.7.1",
|
package/src/scss/_common.scss
CHANGED
|
@@ -307,25 +307,28 @@
|
|
|
307
307
|
margin-bottom: 0;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
position: relative;
|
|
317
|
-
counter-increment: list;
|
|
318
|
-
|
|
319
|
-
&::before {
|
|
320
|
-
position: absolute;
|
|
321
|
-
right: 100%;
|
|
322
|
-
margin-right: 4px;
|
|
323
|
-
content: counters(list, '.') '. ';
|
|
324
|
-
}
|
|
325
|
-
}
|
|
310
|
+
ol {
|
|
311
|
+
counter-reset: list;
|
|
312
|
+
|
|
313
|
+
& > li {
|
|
314
|
+
position: relative;
|
|
315
|
+
counter-increment: list;
|
|
326
316
|
}
|
|
327
317
|
}
|
|
328
318
|
|
|
319
|
+
ol > li > ol > li::marker {
|
|
320
|
+
content: counters(list, '.') '. ';
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
:not(ol > li) > ol > li::marker {
|
|
324
|
+
content: counter(list) '. ';
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// No direct ancestor (>) combinator to preserve legacy behavior
|
|
328
|
+
ol.yfm_no-list-reset li::marker {
|
|
329
|
+
content: unset;
|
|
330
|
+
}
|
|
331
|
+
|
|
329
332
|
li {
|
|
330
333
|
word-wrap: break-word;
|
|
331
334
|
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {Token} from 'markdown-it';
|
|
2
2
|
import {relative} from 'path';
|
|
3
3
|
|
|
4
4
|
import {isLocalUrl} from '../../utils';
|
|
5
5
|
import {resolveRelativePath} from '../../utilsFS';
|
|
6
|
-
import imsize from '../imsize';
|
|
7
6
|
import {MarkdownItPluginOpts} from '../typings';
|
|
8
7
|
|
|
9
8
|
type Options = MarkdownItPluginOpts & {
|
|
10
9
|
destPath: string;
|
|
11
10
|
copyFile: (path: string, dest: string) => void;
|
|
12
11
|
singlePage: boolean;
|
|
12
|
+
tokenStream: Token[];
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const collect = (input: string, options: Options) => {
|
|
16
|
-
const
|
|
16
|
+
const {root, path, destPath = '', copyFile, singlePage, tokenStream} = options;
|
|
17
17
|
|
|
18
|
-
const {root, path, destPath = '', copyFile, singlePage} = options;
|
|
19
|
-
const tokens = md.parse(input, {});
|
|
20
18
|
let result = input;
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
tokenStream.forEach((token) => {
|
|
23
21
|
if (token.type !== 'inline') {
|
|
24
22
|
return;
|
|
25
23
|
}
|