2023-02-03 21:27:30 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
import { marked } from "marked";
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
path: string;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const htmlContent = ref("");
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
axios
|
2023-02-03 21:40:10 +01:00
|
|
|
.get(`/${props.path}.md`)
|
2023-02-03 21:27:30 +01:00
|
|
|
.then((response) => (htmlContent.value = marked.parse(response.data)))
|
|
|
|
.catch(
|
|
|
|
() =>
|
|
|
|
(htmlContent.value = marked.parse(
|
|
|
|
"# 404 Not Found \n \n La page recherchée n'a pas pu être trouvée"
|
|
|
|
))
|
|
|
|
);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div v-html="htmlContent"></div>
|
|
|
|
<slot></slot>
|
|
|
|
</template>
|