Skip to content
Permalink
Browse files

feat: functional source (using markdown when return 'markdown')

  • Loading branch information...
ulivz committed Apr 5, 2019
1 parent 450ecf1 commit 5ef63cd69e929ce700d000476818763f8d6e4708
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/index.js
@@ -37,7 +37,6 @@ module.exports = (opts, ctx) => {

async ready() {
let { repoId, repoUrl, authToken, source } = opts
const useMarkdown = source === 'markdown'

if (repoId) {
assert(
@@ -123,6 +122,11 @@ module.exports = (opts, ctx) => {
if (status && status === 404) {
postContent = `# ${title}\n > 此文档尚未创建`
} else {
const useMarkdown = typeof source === 'string'
? source === 'markdown'
: typeof source === 'function'
? source(page) === 'markdown'
: false
if (useMarkdown || data.format === 'markdown') {
postContent = data.body || ''
} else {

0 comments on commit 5ef63cd

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