remark-mdc icon indicating copy to clipboard operation
remark-mdc copied to clipboard

Binding doc frontmatter in component frontmatter

Open ManUtopiK opened this issue 11 months ago • 2 comments

Version

module: 3.0.2 nuxt: last

Reproduction

Link:

What is expected?

I want to bind value of the frontmatter doc in the frontmatter component.

---
title: The title
---

::alert
---
type:
  - :nested: title
:type2: title
---
slot
::

What is actually happening?

First, it works only for root keys, not for nested keys. You can see the result on the repro. The value of the key :type2 is well replaced by The title, but not the :nested value.

Second, there are 2 problems when we compile the AST to markdown :

  1. The binded root key :type2 is replaced by type2.
  2. The binded nested key :nested is single quoted to ':nested'. Starting a key with : is valid in Yaml, it should not be quoted.

For the first problem, it seems it comes from this line, but if I comment this line, :type2 become single quoted.

Steps to reproduce

Launch vitest on my fork.

Additional information

Checklist

  • [x] I have tested with the latest Nuxt version and the issue still occurs
  • [x] I have tested with the latest module version and the issue still occurs
  • [x] I have searched the issue tracker and this issue hasn't been reported yet

Steps to reproduce

What is expected?

  1. Permit binding nested value.
  2. Keep : of root bind value.
  3. Don't use single quote as it's valid with Yaml.

What is actually happening?

image

ManUtopiK avatar Feb 26 '24 21:02 ManUtopiK