content: Nuxt/content doesn't work for parsing the code in md, which makes the code highlighting invalid.

Environment


  • Operating System: Windows_NT
  • Node Version: v18.16.1
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: yarn@1.22.21
  • Builder: -
  • User Config: extends, modules, content
  • Runtime Modules: @nuxt/content@2.9.0
  • Build Modules: -

Reproduction

In the latest version of nuxt/content, I tried to add code to md files many times, but the HTML parsing of the code was not the expected result. The code demo is as follows:

<script setup lang="ts">
const { data } = await useAsyncData('page-data', () => queryContent('/blogs/basic').findOne())
</script>

<template>
  <main>
    <ContentRenderer :value="data">
      <template #empty>
        <p>No content found.</p>
      </template>
    </ContentRenderer>
  </main>
</template>

Describe the bug

I added code content in markdown, but the code of the actual page generated by nuxt/content was only converted into a string form, just like the following picture, which could not highlight the code. image

I want to convert it to the following HTML structure (just like other people’s nuxt/content projects):

image I don’t know how to achieve the effect of the second picture, should I install plugins or other npm packages? 😢

Additional context

No response

Logs

No response

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 4
  • Comments: 18 (3 by maintainers)

Most upvoted comments

I also have the same issue, and this problem already existed in the previous version

I am also troubled by the same issue.

As a temporary solution, I use version 2.8.2, which does not yet include shikiji.

"@nuxt/content": "2.8.2",

@AssetCEO Yes, I created a new nuxt project, but the problem remains the same. I have given up.😵