@diplodoc/transform 4.60.1 → 4.60.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.
Files changed (39) hide show
  1. package/dist/css/_yfm-only.css +6 -6
  2. package/dist/css/_yfm-only.css.map +3 -3
  3. package/dist/css/_yfm-only.min.css +1 -1
  4. package/dist/css/_yfm-only.min.css.map +3 -3
  5. package/dist/css/base.css +7 -2
  6. package/dist/css/base.css.map +3 -3
  7. package/dist/css/base.min.css +1 -1
  8. package/dist/css/base.min.css.map +3 -3
  9. package/dist/css/print.css.map +1 -1
  10. package/dist/css/yfm.css +13 -8
  11. package/dist/css/yfm.css.map +3 -3
  12. package/dist/css/yfm.min.css +1 -1
  13. package/dist/css/yfm.min.css.map +3 -3
  14. package/dist/js/base.js +5 -0
  15. package/dist/js/base.js.map +2 -2
  16. package/dist/js/base.min.js +1 -1
  17. package/dist/js/base.min.js.map +3 -3
  18. package/dist/js/yfm.js +5 -0
  19. package/dist/js/yfm.js.map +2 -2
  20. package/dist/js/yfm.min.js +1 -1
  21. package/dist/js/yfm.min.js.map +3 -3
  22. package/lib/plugins/inline-code/constant.d.ts +1 -1
  23. package/lib/plugins/inline-code/index.d.ts +1 -1
  24. package/lib/plugins/inline-code/index.js +4 -3
  25. package/lib/plugins/inline-code/index.js.map +1 -1
  26. package/package.json +2 -1
  27. package/src/js/code.ts +4 -0
  28. package/src/js/inline-code/index.ts +5 -0
  29. package/src/scss/_code.scss +5 -2
  30. package/src/scss/_common.scss +16 -10
  31. package/src/scss/_inline-code.scss +9 -9
  32. package/src/scss/_note.scss +5 -3
  33. package/src/scss/_term.scss +9 -9
  34. package/src/scss/_yfm-only.scss +5 -5
  35. package/src/scss/base.scss +4 -4
  36. package/src/scss/print.scss +8 -8
  37. package/src/scss/yfm.scss +7 -6
  38. package/src/transform/plugins/inline-code/constant.ts +1 -1
  39. package/src/transform/plugins/inline-code/index.ts +5 -2
@@ -1,8 +1,8 @@
1
1
  /* stylelint-disable declaration-no-important */
2
2
 
3
- @import 'private';
4
- @import 'brand';
5
- @import 'lists';
3
+ @use 'private';
4
+ @use 'brand';
5
+ @use 'lists';
6
6
 
7
7
  @mixin removeMarginForEdgeChildren {
8
8
  & > *:first-child {
@@ -15,8 +15,8 @@
15
15
  }
16
16
 
17
17
  .yfm {
18
- @include private-brand();
19
- @include brand();
18
+ @include private.private-brand();
19
+ @include brand.brand();
20
20
 
21
21
  font-family: var(--yfm-font-family-sans);
22
22
  font-size: 15px;
@@ -25,6 +25,13 @@
25
25
  color: var(--yfm-color-text);
26
26
  tab-size: var(--yfm-tab-size, inherit);
27
27
 
28
+ --yfm-font-family-monospace:
29
+ 'Menlo', 'Monaco', 'Consolas', 'Ubuntu Mono', 'Liberation Mono', 'DejaVu Sans Mono',
30
+ 'Courier New', 'Courier', monospace;
31
+ --yfm-font-family-sans:
32
+ 'Segoe UI', arial, helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
33
+ 'Segoe UI Symbol';
34
+
28
35
  * {
29
36
  box-sizing: border-box;
30
37
  }
@@ -113,6 +120,10 @@
113
120
  }
114
121
  }
115
122
 
123
+ .mermaid svg[id*='mermaid'] {
124
+ max-height: none;
125
+ }
126
+
116
127
  img {
117
128
  object-fit: contain;
118
129
  background-color: var(--yfm-color-base);
@@ -409,9 +420,4 @@
409
420
  clip-path: inset(100%);
410
421
  user-select: none;
411
422
  }
412
-
413
- --yfm-font-family-monospace: 'Menlo', 'Monaco', 'Consolas', 'Ubuntu Mono', 'Liberation Mono',
414
- 'DejaVu Sans Mono', 'Courier New', 'Courier', monospace;
415
- --yfm-font-family-sans: 'Segoe UI', arial, helvetica, sans-serif, 'Apple Color Emoji',
416
- 'Segoe UI Emoji', 'Segoe UI Symbol';
417
423
  }
@@ -2,15 +2,6 @@
2
2
  position: absolute;
3
3
  z-index: 100;
4
4
 
5
- width: fit-content;
6
- max-width: 450px;
7
-
8
- @media screen and (max-width: 600px) {
9
- & {
10
- max-width: 80%;
11
- }
12
- }
13
-
14
5
  visibility: hidden;
15
6
  opacity: 0;
16
7
 
@@ -26,6 +17,15 @@
26
17
 
27
18
  box-shadow: 0 8px 20px var(--yfm-color-term-dfn-shadow);
28
19
  outline: none;
20
+ width: fit-content;
21
+
22
+ max-width: 450px;
23
+
24
+ @media screen and (max-width: 600px) {
25
+ & {
26
+ max-width: 80%;
27
+ }
28
+ }
29
29
 
30
30
  &::before {
31
31
  content: '';
@@ -1,3 +1,5 @@
1
+ @use 'sass:color';
2
+
1
3
  .yfm .yfm-note {
2
4
  max-width: 1296px;
3
5
  margin: 20px 0;
@@ -40,9 +42,9 @@
40
42
 
41
43
  @each $type, $color in $colors {
42
44
  &.#{$type} > :first-child::before {
43
- $r: red($color);
44
- $g: green($color);
45
- $b: blue($color);
45
+ $r: color.channel($color, 'red', $space: rgb);
46
+ $g: color.channel($color, 'green', $space: rgb);
47
+ $b: color.channel($color, 'blue', $space: rgb);
46
48
  $rgbColor: 'rgb(' + $r + ',' + $g + ',' + $b + ')';
47
49
  content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="' + $rgbColor + '"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
48
50
  }
@@ -18,15 +18,6 @@
18
18
  position: absolute;
19
19
  z-index: 100;
20
20
 
21
- width: fit-content;
22
- max-width: 450px;
23
-
24
- @media screen and (max-width: 600px) {
25
- & {
26
- max-width: 80%;
27
- }
28
- }
29
-
30
21
  visibility: hidden;
31
22
  opacity: 0;
32
23
 
@@ -43,6 +34,15 @@
43
34
  box-shadow: 0 8px 20px var(--yfm-color-term-dfn-shadow);
44
35
  outline: none;
45
36
 
37
+ width: fit-content;
38
+ max-width: 450px;
39
+
40
+ @media screen and (max-width: 600px) {
41
+ & {
42
+ max-width: 80%;
43
+ }
44
+ }
45
+
46
46
  &::before {
47
47
  content: '';
48
48
  position: absolute;
@@ -6,8 +6,8 @@
6
6
  as the file is subject to changes without prior notice.
7
7
  */
8
8
 
9
- @import 'note';
10
- @import 'katex';
11
- @import 'table';
12
- @import 'term';
13
- @import 'inline-code';
9
+ @use 'note';
10
+ @use 'katex';
11
+ @use 'table';
12
+ @use 'term';
13
+ @use 'inline-code';
@@ -1,4 +1,4 @@
1
- @import 'common';
2
- @import 'anchor';
3
- @import 'highlight';
4
- @import 'code';
1
+ @use 'common';
2
+ @use 'anchor';
3
+ @use 'highlight';
4
+ @use 'code';
@@ -1,8 +1,8 @@
1
- @import 'print/code';
2
- @import 'print/common';
3
- @import 'print/cut';
4
- @import 'print/note';
5
- @import 'print/table';
6
- @import 'print/tabs';
7
- @import 'print/term';
8
- @import 'print/iframe';
1
+ @use 'print/code';
2
+ @use 'print/common';
3
+ @use 'print/cut';
4
+ @use 'print/note';
5
+ @use 'print/table';
6
+ @use 'print/tabs';
7
+ @use 'print/term';
8
+ @use 'print/iframe';
package/src/scss/yfm.scss CHANGED
@@ -1,6 +1,7 @@
1
- @import 'base';
2
- @import 'yfm-only';
3
- @import 'modal';
4
- @import '@diplodoc/cut-extension/runtime';
5
- @import '@diplodoc/file-extension/runtime';
6
- @import '@diplodoc/tabs-extension/runtime';
1
+ @use 'base';
2
+ @use 'yfm-only';
3
+ @use 'modal';
4
+
5
+ @forward '@diplodoc/cut-extension/runtime';
6
+ @forward '@diplodoc/file-extension/runtime';
7
+ @forward '@diplodoc/tabs-extension/runtime';
@@ -1,4 +1,4 @@
1
- import {Lang} from '../typings';
1
+ import type {Lang} from '../typings';
2
2
 
3
3
  export const LANG_TOKEN: Record<Lang, string> = {
4
4
  ru: 'Скопировано',
@@ -1,4 +1,7 @@
1
- import {MarkdownItPluginCb, StateCore} from '../../typings';
1
+ import type {MarkdownItPluginCb, StateCore} from '../../typings';
2
+
3
+ import {escapeHtml} from 'markdown-it/lib/common/utils';
4
+
2
5
  import {generateID} from '../utils';
3
6
 
4
7
  import {LANG_TOKEN, LANG_TOKEN_DESCRIPTION, LANG_TOKEN_LABEL} from './constant';
@@ -12,7 +15,7 @@ const inlineCode: MarkdownItPluginCb = (md, options) => {
12
15
  const description = LANG_TOKEN_DESCRIPTION[lang] ?? LANG_TOKEN_DESCRIPTION.en;
13
16
  const label = LANG_TOKEN_LABEL[lang] ?? LANG_TOKEN_LABEL.en;
14
17
 
15
- return `<code class="yfm-clipboard-inline-code" role="button" aria-label="${label}" aria-description="${description}" tabindex='0' id="${id}">${tokens[idx].content}</code>`;
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>`;
16
19
  };
17
20
 
18
21
  md.core.ruler.after('inline', 'tooltip_code_inline', (state: StateCore) => {