@diplodoc/cli-tests 5.5.3 → 5.6.0

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.
@@ -685,7 +685,7 @@ exports[`Regression > internal 28`] = `
685
685
  <body class="g-root g-root_theme_light">
686
686
  <div id="root"></div>
687
687
  <script type="application/json" id="diplodoc-state">
688
- {"data":{"leading":false,"html":"&lt;p&gt;Text {{not-var}} {{skip()}} default-var-value&lt;/p&gt;/n&lt;p&gt;Text &lt;code&gt;{{not-var}}&lt;/code&gt; &lt;code&gt;{{skip()}}&lt;/code&gt; &lt;code&gt;default-var-value&lt;/code&gt;&lt;/p&gt;/n&lt;p&gt;Text&lt;/p&gt;/n/n &lt;div class=\\"yfm-clipboard\\"&gt;/n &lt;pre&gt;&lt;code class=\\"hljs\\"&gt;{{not-var}}/n/n{{skip()}}/n/ndefault-var-value/n&lt;/code&gt;&lt;/pre&gt;/n/n &lt;button class=\\"yfm-clipboard-button\\"&gt;/n &lt;svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"yfm-clipboard-icon\\" data-animation=\\"9\\"&gt;/n &lt;path fill=\\"currentColor\\" d=\\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\\"&gt;&lt;/path&gt;/n &lt;path stroke=\\"currentColor\\" fill=\\"transparent\\" stroke-width=\\"1.5\\" d=\\"M9.5 13l3 3l5 -5\\" visibility=\\"hidden\\"&gt;/n &lt;animate id=\\"visibileAnimation-9\\" attributeName=\\"visibility\\" from=\\"hidden\\" to=\\"visible\\" dur=\\"0.2s\\" fill=\\"freeze\\" begin&gt;&lt;/animate&gt;/n &lt;animate id=\\"hideAnimation-9\\" attributeName=\\"visibility\\" from=\\"visible\\" to=\\"hidden\\" dur=\\"1s\\" begin=\\"visibileAnimation-9.end+1\\" fill=\\"freeze\\"&gt;&lt;/animate&gt;/n &lt;/path&gt;/n &lt;/svg&gt;/n &lt;/button&gt;/n &lt;/div&gt;/n&lt;p&gt;&lt;code&gt;[not a link](./path/to/relative/file.md)&lt;/code&gt;&lt;/p&gt;/n&lt;h2 id=\\"subtitle\\"&gt;&lt;a href=\\"1.html#subtitle\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Subtitle&lt;/span&gt;&lt;/a&gt;Subtitle&lt;/h2&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html\\"&gt;Mermaid usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html#info\\"&gt;Mermaid info&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"latex.html\\"&gt;Latex usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"includes\\"&gt;noext-link&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[{"title":"Subtitle","href":"1.html#subtitle","level":2}],"title":"Title"},"router":{"pathname":"1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
688
+ {"data":{"leading":false,"html":"&lt;p&gt;Text {{not-var}} {{skip()}} default-var-value&lt;/p&gt;/n&lt;p&gt;Text &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-1"&gt;{{not-var}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-2"&gt;{{skip()}}&lt;/code&gt; &lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-3"&gt;default-var-value&lt;/code&gt;&lt;/p&gt;/n&lt;p&gt;Text&lt;/p&gt;/n/n &lt;div class=\\"yfm-clipboard\\"&gt;/n &lt;pre&gt;&lt;code class=\\"hljs\\"&gt;{{not-var}}/n/n{{skip()}}/n/ndefault-var-value/n&lt;/code&gt;&lt;/pre&gt;/n/n &lt;button class=\\"yfm-clipboard-button\\"&gt;/n &lt;svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"yfm-clipboard-icon\\" data-animation=\\"9\\"&gt;/n &lt;path fill=\\"currentColor\\" d=\\"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z\\"&gt;&lt;/path&gt;/n &lt;path stroke=\\"currentColor\\" fill=\\"transparent\\" stroke-width=\\"1.5\\" d=\\"M9.5 13l3 3l5 -5\\" visibility=\\"hidden\\"&gt;/n &lt;animate id=\\"visibileAnimation-9\\" attributeName=\\"visibility\\" from=\\"hidden\\" to=\\"visible\\" dur=\\"0.2s\\" fill=\\"freeze\\" begin&gt;&lt;/animate&gt;/n &lt;animate id=\\"hideAnimation-9\\" attributeName=\\"visibility\\" from=\\"visible\\" to=\\"hidden\\" dur=\\"1s\\" begin=\\"visibileAnimation-9.end+1\\" fill=\\"freeze\\"&gt;&lt;/animate&gt;/n &lt;/path&gt;/n &lt;/svg&gt;/n &lt;/button&gt;/n &lt;/div&gt;/n&lt;p&gt;&lt;code class=\\"yfm-clipboard-inline-code\\" role=\\"button\\" tabindex=\\"0\\" id="inline-code-id-4"&gt;[not a link](./path/to/relative/file.md)&lt;/code&gt;&lt;/p&gt;/n&lt;h2 id=\\"subtitle\\"&gt;&lt;a href=\\"1.html#subtitle\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Subtitle&lt;/span&gt;&lt;/a&gt;Subtitle&lt;/h2&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html\\"&gt;Mermaid usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"mermaid.html#info\\"&gt;Mermaid info&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"latex.html\\"&gt;Latex usage&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"includes\\"&gt;noext-link&lt;/a&gt;&lt;/p&gt;/n&lt;p&gt;Bob&lt;/p&gt;/n&lt;div class=\\"yfm inline_code_tooltip\\" id=\\"tooltip_inline_clipboard_dialog\\" role=\\"dialog\\"&gt;Скопировано&lt;/div&gt;","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[{"title":"Subtitle","href":"1.html#subtitle","level":2}],"title":"Title"},"router":{"pathname":"1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
689
689
  </script>
690
690
  <script type="application/javascript">
691
691
  const data = document.querySelector('script#diplodoc-state');
@@ -14,7 +14,6 @@ function test(path: string, expect: Function) {
14
14
 
15
15
  const md = await TestAdapter.build.run(inputPath, outputPath, ['-j2', '-f', 'md']);
16
16
  const html = await TestAdapter.build.run(inputPath, outputPath + '-html', ['-j2', '-f', 'html']);
17
-
18
17
  return expect({md, html});
19
18
  });
20
19
  }
@@ -28,6 +27,14 @@ describe('Errors', () => {
28
27
  });
29
28
  });
30
29
 
30
+ describe('Warnings', () => {
31
+ test('mocks/warning/unreachable-autotitle', ({html}: TestResult) => {
32
+ expectWarnings(html, [
33
+ 'WARN index.md: 1: YFM010 / unreachable-autotitle-anchor Auto title anchor is unreachable [Context: "[Unreachable autotitle anchor: "link.html#unknown_yfm010"][{#T}](./link.md#unknown_yfm010)"]',
34
+ ]);
35
+ });
36
+ });
37
+
31
38
  function expectErrors(report: Report, errors: string[]) {
32
39
  expect(report.code).toEqual(1);
33
40
 
@@ -35,3 +42,11 @@ function expectErrors(report: Report, errors: string[]) {
35
42
  expect(report.errors).toContain(error);
36
43
  }
37
44
  }
45
+
46
+ function expectWarnings(report: Report, warnings: string[]) {
47
+ expect(report.warns.length).toEqual(warnings.length);
48
+
49
+ for (const warn of warnings) {
50
+ expect(report.warns).toContain(warn);
51
+ }
52
+ }
@@ -1,6 +1,8 @@
1
1
  import {readFileSync} from 'node:fs';
2
2
 
3
3
  export function platformless(text: string): string {
4
+ let index = 1;
5
+
4
6
  return hashless(text)
5
7
  .replace(/\r\n/g, '\n')
6
8
  .replace(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/g, 'UUID')
@@ -8,7 +10,11 @@ export function platformless(text: string): string {
8
10
  /(content"?[:=]{1}[" ]{1}Diplodoc.*? )v\d+\.\d+\.\d+(?:-[\w-]+)?/g,
9
11
  `$1vDIPLODOC-VERSION`,
10
12
  )
11
- .replace(/(\\(?![/"'])){1,2}/g, '/');
13
+ .replace(/(\\(?![/"'])){1,2}/g, '/')
14
+ .replace(
15
+ /id=\\"inline-code-id-[a-zA-Z0-9]{8}\\"/g,
16
+ () => `id="inline-code-id-${index++}"`
17
+ )
12
18
  }
13
19
 
14
20
  export function hashless(text: string): string {
@@ -0,0 +1 @@
1
+ [{#T}](./link.md#unknown_yfm010)
@@ -0,0 +1,4 @@
1
+ href: index.md
2
+ items:
3
+ name: link
4
+ href: link.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.5.3",
3
+ "version": "5.6.0",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },