Do you want to work on this issue?
You can request for a bounty in order to promote it!
Feature: import code snippet with a Vue component #83
egoist posted onGitHub
<!-- Please don't delete this template or we'll close your issue -->
<!-- Before creating an issue please make sure you are using the latest version of Saber. -->
Feature request
<!-- Please ask questions via following several ways. -->
<!-- https://chat.saber.land/ -->
<!-- https://stackoverflow.com/questions/ask?tags=saberjs -->
What problem does this feature solve?
Import code snippet in Vue template, which means it works in Markdown page, Vue page or even HTML page and Pug page, it just works everywhere
What does the proposed API look like?
Simply use the Vue component:
<import-snippet path="./sample-code.js" highlightLines="[1,3]" />
How should this be implemented in your opinion?
Use a custom vue-template-compiler module to transform:
<import-snippet path="./sample-code.js" highlightLines="[1,3]" />
to:
<import-snippet
:content="require('!import-snippet-loader?{highlightLines:[1,3]}!./sample-code.js')"
/>
import-snippet-loader
is webpack loader which uses saber-markdown to transform the code into <pre><code></code></pre>
and returns it.
Are you willing to work on this yourself?
Yes