Cleanup metadata doc generation (#2684)

* Cleanup metadata doc generation

* Remove tmp
This commit is contained in:
Jaco Greeff
2020-10-06 11:16:43 +02:00
committed by GitHub
parent 6bb43d4cfa
commit 014fa123b9
2 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -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",
+6 -6
View File
@@ -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`;