rspress icon indicating copy to clipboard operation
rspress copied to clipboard

[Bug]: Yaml in frontmatter parsing keep failing

Open zmzlois opened this issue 7 months ago • 3 comments

Version

System:
    OS: macOS 14.2.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 90.42 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 126.0.6478.127
    Edge: 126.0.2592.81
    Safari: 17.2.1
  npmPackages:
    @rspress/mdx-rs: ^0.5.7 => 0.5.7
    @rspress/plugin-shiki: ^1.23.1 => 1.23.1
    rspress: ^1.18.1 => 1.18.1

Details

after I added metadata tag in frontmatter (tried several formats, spacing) and it keeps failing:

error below

npm run dev

>[email protected] dev
> rspress dev

🔥 Rspress v1.18.1

thread 'thread '<unnamed><unnamed>' panicked at ' panicked at crates/plugin_frontmatter/src/lib.rscrates/plugin_frontmatter/src/lib.rs::1414::3636:
:
Failed to parse yaml: title: DE20020 - Failed to get application hash list.
description: Error - DE20020 - Workaround and debug for error: Failed to get application hash list.
head:
  - - meta
    - name: og:title
      content: Error - DE20020 - Failed to get application hash list.
  - - meta
    - name: og:url
      content: https://docs.com/guide/error/de20020。: Error { kind: SCANNER, problem: "mapping values are not allowed in this context", problem_mark: Mark { line: 2, column: 69 } }Failed to parse yaml: title: DE20019 - Snapshot upload gave no results
description: Error - DE20019 - Workaround and debug for error: snapshot upload gave no results
head:
  - - meta
    - name: og:title
      content: Error - DE20019 - Snapshot upload gave no results
  - - meta
    - name: og:url
      content: https://docs.com/guide/error/de20019。: Error { kind: SCANNER, problem: "mapping values are not allowed in this context", problem_mark: Mark { line: 2, column: 69 } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

fatal runtime error: failed to initiate panic, error 5
fatal runtime error: failed to initiate panic, error 5
zsh: abort      npm run dev

My frontmatter in each file looks like:

---
title: BU10013 - package.json must have a name and version
description: Error - BU10013 - Why does package.json needs to have a name and version? What happens when we don't have one?
head: 
  - - meta
    - name: og:title
      content: Error - BU10013 - package.json must have a name and version
  - - meta
    - name: og:url 
      content: https://docs.com/guide/error/bu10013
---

I have also tried this (check the spacing betwee - -

---
title: BU10013 - package.json must have a name and version
description: Error - BU10013 - Why does package.json needs to have a name and version? What happens when we don't have one?
head: 
- - meta
   - name: og:title
      content: Error - BU10013 - package.json must have a name and version
- - meta
   - name: og:url 
      content: https://docs.com/guide/error/bu10013
---

Not entirely sure what did I do wrong as i was following this guide here: https://rspress.dev/api/config/config-frontmatter#head

Reproduce link

https://github.com/ZephyrCloudIO/zephyr-documentation/tree/get-started

Reproduce Steps

clone the repo and run npm i && npm run dev

zmzlois avatar Jun 27 '24 23:06 zmzlois