vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.19k stars 2.12k forks source link

vitepress can't parse code in xml format.(vitepress解析不了代码格式为xml) #4078

Open fakerlove1 opened 3 months ago

fakerlove1 commented 3 months ago

Describe the bug

80ad1a28a245b752e6087e82fde98066

156d965206af76411dc70ac30f8fc10e

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.example</groupId>
  <artifactId>example-proj</artifactId>
  <version>1.0.0</version>

  <name>Example Project</name>
  <description>This is an example Maven project.</description>
  <url>http://www.example.com/</url>

  <licenses>   <!-- 许可证 -->
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>     <!-- 开发者信息 -->
    <developer>
      <id>developer1</id>
      <name>Developer One</name>
      <email>developer1@example.com</email>
      <organization>Example Organizations Inc.</organization>
      <organizationUrl>http://www.example-organizations.com/</organizationUrl>
      <roles>
        <role>developer</role>
      </roles>
      <timezone>-5</timezone>
    </developer>
  </developers>

  <dependencies>  <!-- 依赖项 -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>5.2.1.RELEASE</version>
    </dependency>
  </dependencies>

  <build>   <!-- 项目构建 -->
    <plugins>   <!-- 插件配置 -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>com.example.App</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Reproduction

{ "devDependencies": { "markdown-it-mathjax3": "^4.3.2", "vitepress": "1.2.3", "vue": "3.4.31" }, "scripts": { "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:preview": "vitepress preview docs" }, "dependencies": { "markdown-it-katex": "^2.0.3" } }

Expected behavior

156d965206af76411dc70ac30f8fc10e

System Info

at createCompilerError (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1328:17)
      at emitError (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2812:5)
      at Object.onclosetag (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2179:13)
      at Tokenizer.stateInClosingTagName (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:749:16)
      at Tokenizer.parse (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:1107:16)
      at Object.baseParse (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-core@3.4.31\node_modules\@vue\compiler-core\dist\compiler-core.cjs.js:2851:13)
      at Object.parse (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-dom@3.4.31\node_modules\@vue\compiler-dom\dist\compiler-dom.cjs.js:706:23)
      at Object.parse$2 [as parse] (D:\code\vitpress\node_modules\.pnpm\@vue+compiler-sfc@3.4.31\node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:1850:24)
      at createDescriptor (file:///D:/code/vitpress/node_modules/.pnpm/@vitejs+plugin-vue@5.0.5_vite@5.3.3_vue@3.4.31/node_modules/@vitejs/plugin-vue/dist/index.mjs:64:43)
      at handleHotUpdate (file:///D:/code/vitpress/node_modules/.pnpm/@vitejs+plugin-vue@5.0.5_vite@5.3.3_vue@3.4.31/node_modules/@vitejs/plugin-vue/dist/index.mjs:2160:26)

Additional context

No response

Validations

brc-dd commented 3 months ago

Ah, the stack traces in markdown files are not reliable. Check if some place outside that code block you're using <something> without back ticks or back slashes. That code block doesn't have any issue - https://stackblitz.com/edit/vite-znqsyg?file=docs/index.md