Cleanup metadata doc generation (#2684)
* Cleanup metadata doc generation * Remove tmp
This commit is contained in:
+2
-1
@@ -14,7 +14,8 @@
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts && (cd packages/typegen && copyfiles scripts/* build)",
|
||||
"build:interfaces": "polkadot-types-internal-interfaces",
|
||||
"build:release": "polkadot-ci-ghact-build",
|
||||
"docs": "polkadot-types-internal-metadata && polkadot-dev-build-docs",
|
||||
"docs": "yarn docs:metadata && polkadot-dev-build-docs",
|
||||
"docs:metadata": "polkadot-types-internal-metadata",
|
||||
"docs:release": "polkadot-ci-ghact-docs",
|
||||
"chain:info": "polkadot-types-chain-info",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
|
||||
@@ -46,18 +46,18 @@ function documentationVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
|
||||
? `${md}\n\n` // empty line
|
||||
: /^[*-]/.test(docLine.trimStart()) && !md.endsWith('\n\n')
|
||||
? `${md}\n\n${docLine}` // line calling for a preceding linebreak
|
||||
: `${md}${docLine // line continuing the preceding line
|
||||
.replace(/^# <weight>$/g, '\\# \\<weight>\n\n')
|
||||
.replace(/^# <\/weight>$/g, '\n\n\\# \\</weight>')
|
||||
.replace(/^#{1,3} /, '#### ')} `
|
||||
, '');
|
||||
: `${md}${docLine.replace(/^#{1,3} /, '#### ')} `
|
||||
, '')
|
||||
.replace(/#### <weight>/g, '<weight>')
|
||||
.replace(/<weight>(.|\n)*?<\/weight>/g, '')
|
||||
.replace(/#### Weight:/g, 'Weight:');
|
||||
|
||||
// prefix each line with indentation
|
||||
return md && md.split('\n\n').map((line) => `${' '.repeat(indent)}${line}`).join('\n\n');
|
||||
}
|
||||
|
||||
function renderPage (page: Page): string {
|
||||
let md = `## ${page.title}\n\n`;
|
||||
let md = `---\ntitle: ${page.title}\n---\n\n`;
|
||||
|
||||
if (page.description) {
|
||||
md += `${page.description}\n\n`;
|
||||
|
||||
Reference in New Issue
Block a user