Skip to content

Commit

Permalink
fix(title): do not add duplicate header for vuedoc.md parsed files (#16)
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and ph1p committed Feb 25, 2019
1 parent ffe0d03 commit b1d267c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmds/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,17 @@ async function generate(argv) {

let fileContent = '---\n';

fileContent += !attributes || !attributes.title ? `title: ${file}` : '';
fileContent += !attributes || !attributes.title ? `title: ${fileName}` : '';

if (frontmatter) {
fileContent += !attributes || !attributes.title ? '\n' : '';
fileContent += `${frontmatter}`;
}

fileContent += '\n---\n';
fileContent += `\n# ${attributes && attributes.title ? attributes.title : file}\n\n`;
if ((attributes && attributes.title) || !/\.vue$/.test(file)) {
fileContent += `\n# ${attributes && attributes.title ? attributes.title : fileName}\n\n`;
}
fileContent += mdFileData;

await fs.writeFile(`${folderPath}/${fileName}.md`, fileContent);
Expand Down

0 comments on commit b1d267c

Please sign in to comment.