Skip to content
Permalink
Browse files

fix: ## ... shouldn't be considered as title

  • Loading branch information...
ulivz committed Apr 5, 2019
1 parent 2e23464 commit f30c89339f6f4b1c468a3c62cedd620340fab32b
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/index.js
@@ -3,7 +3,7 @@
*/

const assert = require('assert')
const { chalk, parseFrontmatter, inferTitle } = require('@vuepress/shared-utils')
const { chalk, parseFrontmatter } = require('@vuepress/shared-utils')
const Yuque = require('./yuque')
const { getSidebarByToc } = require('./toc')
const spinner = require('./spinner')
@@ -179,3 +179,19 @@ module.exports = (opts, ctx) => {
}
}
}

/**
* Infer title, forked from VuePress.
*/
function interTitle(frontmatter, strippedContent) {
if (frontmatter.home) {
return 'Home';
}
if (frontmatter.title) {
return frontmatter.title
}
const match = strippedContent.trim().match(/^#\s+(.*)/);
if (match) {
return match[1];
}
};

0 comments on commit f30c893

Please sign in to comment.
You can’t perform that action at this time.