How to use @vuepress/markdown-loader - 3 common examples

To help you get started, we’ve selected a few @vuepress/markdown-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuepress / packages / @vuepress / core / lib / internal-plugins / frontmatterBlock / loader.js View on Github external
module.exports = function (source, map) {
  const isProd = process.env.NODE_ENV === 'production'

  if (!isProd) {
    const file = this.resourcePath
    // frontmatter changed... need to do a full reload
    const cached = cache.get(file)
    const parsed = parseStrippedFrontmatter(source)

    if (cached &&
      cached.data &&
      parsed &&
      parsed.data &&
      JSON.stringify(cached.data) !== JSON.stringify(parsed.data)
    ) {
      frontmatterEmitter.emit('update')
    }

    cache.set(file, parsed)
  }

  this.callback(null, '', map)
}
github vuejs / vuepress / packages / @vuepress / core / lib / dev.js View on Github external
(
      ctx.siteConfig.extraWatchFiles || []
    ).map(file => normalizeWatchFilePath(file, ctx.sourceDir))
  )

  logger.debug('watchFiles', watchFiles)

  // watch config file
  const configWatcher = chokidar.watch(watchFiles, {
    cwd: sourceDir,
    ignoreInitial: true
  })
  configWatcher.on('change', spawnUpdate('change'))

  // also listen for frontmatter changes from markdown files
  frontmatterEmitter.on('update', () => update('frontmatter or headers change'))

  // resolve webpack config
  let config = createClientConfig(ctx)

  config
    .plugin('html')
    // using a fork of html-webpack-plugin to avoid it requiring webpack
    // internals from an incompatible version.
    .use(require('vuepress-html-webpack-plugin'), [{
      template: ctx.devTemplate
    }])

  config
    .plugin('site-data')
    .use(HeadPlugin, [{
      tags: ctx.siteConfig.head || []
github vuejs / vuepress / packages / @vuepress / core / lib / node / dev / index.js View on Github external
watchFrontmatter () {
    frontmatterEmitter.on('update', target => this.handleUpdate('frontmatter', target))
  }

@vuepress/markdown-loader

markdown-loader for vuepress

MIT
Latest version published 9 months ago

Package Health Score

75 / 100
Full package analysis