I have a vue/vie project in which I'm trying to read a markdown file I have into html using marked.
I attempted to use the fetch api to import it as a string, but only because I couldn't figure out how to use node.js code in vue.
Here's the vue file:
<script setup>
import { marked } from 'marked'
</script>
<script>
export default {
data() {
return {
query: this.getQueryVariable("q"),
markdown: ''
}
},
mounted() {
fetch('../src/markdown/About.md')
.then(response => response.text())
.then(text => this.markdown = text)
document.querySelector('.marked').innerHTML = marked.parse(this.markdown)
}
}
</script>
<template>
<div class='marked'>
</div>
</template>
'C:\\test.txt'
then it works well... but if I load a text file that has no extensions like/proc/cpuinfo
that import treats it as URL so it can't be resolved...neither if I set as.//proc//cpuinfo
... how I can set the stuff to make reading the file? Thanks in advance! – Weanling