Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Latest commit

 

History

History
58 lines (47 loc) · 873 Bytes

README.md

File metadata and controls

58 lines (47 loc) · 873 Bytes

markdown-sample

必要なパッケージのインストール

npm install --save-dev html-loader markdown-loader

vue.config.js

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.md$/,
          use: [
            {
              loader: "html-loader"
            },
            {
              loader: "markdown-loader",
              options: {
                /* your options here */
              }
            }
          ]
        }
      ]
    }
  }
};

〇〇.js

@/assets/markdowns/sample.md にマークダウンが配置されているとして...

<template>
  <div>
    <div v-html="sampleMd"></div>
  </div>
</template>

<script>
import sampleMd from "@/assets/markdowns/sample.md";

export default {
  created() {
    this.sampleMd = sampleMd;
  }
};
</script>