chore: organize markdoc lib
This commit is contained in:
+29
-29
@@ -8,35 +8,6 @@ import Fence from '../components/Fence';
|
|||||||
import { DOCS_PATH } from '../constants';
|
import { DOCS_PATH } from '../constants';
|
||||||
import { Doc, DocSection } from './../types/types';
|
import { Doc, DocSection } from './../types/types';
|
||||||
|
|
||||||
export function getCopyPath(
|
|
||||||
version: string,
|
|
||||||
doc: Doc,
|
|
||||||
docPath: string
|
|
||||||
): string {
|
|
||||||
if (doc.copy === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return path.join(DOCS_PATH, version, docPath, doc.copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getExamplePath(
|
|
||||||
version: string,
|
|
||||||
doc: Doc,
|
|
||||||
docPath: string
|
|
||||||
): string {
|
|
||||||
if (doc.example === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return path.join(
|
|
||||||
DOCS_PATH,
|
|
||||||
version,
|
|
||||||
docPath,
|
|
||||||
doc.example
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const markDocConfig = {
|
const markDocConfig = {
|
||||||
nodes: {
|
nodes: {
|
||||||
fence: {
|
fence: {
|
||||||
@@ -95,6 +66,35 @@ function parseMarkdown(sourcePath: string): ReactNode {
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCopyPath(
|
||||||
|
version: string,
|
||||||
|
doc: Doc,
|
||||||
|
docPath: string
|
||||||
|
): string {
|
||||||
|
if (doc.copy === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.join(DOCS_PATH, version, docPath, doc.copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getExamplePath(
|
||||||
|
version: string,
|
||||||
|
doc: Doc,
|
||||||
|
docPath: string
|
||||||
|
): string {
|
||||||
|
if (doc.example === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.join(
|
||||||
|
DOCS_PATH,
|
||||||
|
version,
|
||||||
|
docPath,
|
||||||
|
doc.example
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getCopyChild(
|
function getCopyChild(
|
||||||
version: string,
|
version: string,
|
||||||
doc: Doc,
|
doc: Doc,
|
||||||
|
|||||||
Reference in New Issue
Block a user