gaearon / gitbook-plugin-prism

Gitbook plugin for Prism highlighting
Apache License 2.0
88 stars 26 forks source link

warn: "options.generator" property is deprecated, use "output.name" instead #36

Open guocaoyi opened 5 years ago

guocaoyi commented 5 years ago

index.js#39L

function isEbook(book) {
  // 2.x
  if (book.options && book.options.generator) {
    return book.options.generator === 'ebook';
  }

  // 3.x
  return book.output.name === 'ebook';
}

book.options.generator is a get/set,you could change to

function isEbook(book) {
  // 2.x
  if (/^2+\.\d+\.\d+$/.test(book.gitbook.version)) {
    return book.options.generator === 'ebook';
  }
  return book.output.name === 'ebook';
}
guocaoyi commented 5 years ago

WeChatWorkScreenshot_e309cc5c-afef-4e61-86a2-4ab9b9c90881 WeChatWorkScreenshot_f4aa9a8c-c1da-427e-8ad9-e4e09c285fd4

JoeyBling commented 5 years ago

Hi,how to update gitbook version validation?