fix: relative paths

This commit is contained in:
Sidharth Vinod 2022-10-13 13:51:27 +05:30
parent 30a3a9ee53
commit d62c2d1e22
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
4 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/developer-docs/configuration.md](../packages/mermaid/src/docs/developer-docs/configuration.md).
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/developer-docs/configuration.md](../../packages/mermaid/src/docs/developer-docs/configuration.md).
# Configuration

View File

@ -1,4 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/diagrams-and-syntax-and-examples/flowchart.md](../packages/mermaid/src/docs/diagrams-and-syntax-and-examples/flowchart.md).
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/diagrams-and-syntax-and-examples/flowchart.md](../../packages/mermaid/src/docs/diagrams-and-syntax-and-examples/flowchart.md).
---

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<!--# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/landing/index.html](../packages/mermaid/src/docs/landing/index.html).--><head>
<!--# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [packages/mermaid/src/docs/landing/index.html](../../packages/mermaid/src/docs/landing/index.html).--><head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

View File

@ -35,7 +35,7 @@ import { exec } from 'child_process';
import { globby } from 'globby';
import { JSDOM } from 'jsdom';
import type { Code, Root } from 'mdast';
import { posix, dirname } from 'path';
import { posix, dirname, relative } from 'path';
import prettier from 'prettier';
import { remark } from 'remark';
// @ts-ignore No typescript declaration file
@ -72,8 +72,11 @@ let filesWereTransformed = false;
const generateHeader = (file: string): string => {
// path from file in docs/* to repo root, e.g ../ or ../../ */
const rootDirectory = relative(file, "packages/mermaid/src/docs");
return `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [${file}](${join(rootDirectory, file)}).`;
const rootDirectory = relative(file, SOURCE_DOCS_DIR);
return `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the source file in [${file}](${posix.join(
rootDirectory,
file
)}).`;
};
/**