nuxt markdown code example
Example: Nuxt js '@nuxtjs/markdownit'
export default {
async asyncData({ $axios, $md }) {
const home = await $axios.$get("/home-page");
const content = $md.render(home.content);
const apiRoute = 'http://localhost:1337';
const heroImageUrl = apiRoute + home.hero_image.url;
const posts = await $axios.$get("/posts?_limit=4");
const projects = await $axios.$get("/projects?_limit=2");
const project = projects[0];
const projectImage = apiRoute + project.main_image.url;
const projectDescription = $md.render(project.description)
const secondProject = projects[1];
const secondProjectImage = apiRoute + secondProject.main_image.url;
const secondProjectDescription = $md.render(secondProject.description)
return {
home,
heroImageUrl,
posts,
content,
project,
projectImage,
projectDescription,
secondProject,
secondProjectImage,
secondProjectDescription };
},
};