QingWei-Li / vue-markdown-loader

📇 Convert Markdown file to Vue2.0 component.
704 stars 161 forks source link

Improvements for use with <template lang="md"> #10

Closed asselin closed 7 years ago

asselin commented 7 years ago

This references the word I did on this fork/branch: https://github.com/PointSource/vue-markdown-loader/tree/vue-file-support

The use case I'd like to improve is creating a .vue file with <template lang="md">. It currently works if you use vue-markdown-loader as the loader for those markdown files, but there are a couple of issues:

Since this use case has vue-loader as the very first loader in the chain, this fork removes a bunch of code that deals with parsing out the <script> and <styles> tags, and running the result through vue-loader.

For this to work, I submitted a PR to vue-loader (https://github.com/vuejs/vue-loader/pull/595) that will add the template-compiler loader to any loader used for the <template> tag that is specified in the webpack configuration.

I'm opening this issue to start a discussion on whether you're interested in merging these 2 use cases, code, etc. I think it might be possible to inspect the loader command line and select the mode of operation, but wanted to get your thoughts first.

Let me know. Thanks!

QingWei-Li commented 7 years ago

Hi, @asselin, sorry for the late reply.

The purpose of creating this plugin is to be able to write vue examples in the markdown documents.I do not care if I can write markdown in vue files. Second, vue-loader has been supported in the custom template tag. (Your PR)

Maybe you can create another plugin to implement your idea. 😊

asselin commented 7 years ago

FYI, I forked and created another package, markdownit-loader. It can handle lang="md" in Vue components, and be used to transform markdown files into html files, suitable for feeding into raw-loader.

npm package is located at https://www.npmjs.com/package/markdownit-loader, and the github project is at https://github.com/BlueOakJS/markdownit-loader

Thanks!