Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding doc frontmatter in component frontmatter #72

Open
5 tasks done
ManUtopiK opened this issue Feb 26, 2024 · 2 comments
Open
5 tasks done

Binding doc frontmatter in component frontmatter #72

ManUtopiK opened this issue Feb 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ManUtopiK
Copy link
Contributor

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

  • I have tested with the latest Nuxt version and the issue still occurs
  • I have tested with the latest module version and the issue still occurs
  • 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 ManUtopiK added the bug Something isn't working label Feb 26, 2024
@Atinux
Copy link
Member

Atinux commented May 14, 2024

Sorry about this @ManUtopiK

Would you feel like trying to open a PR to fix that?

@ManUtopiK
Copy link
Contributor Author

The quote problem seems coming from js-yaml. I opened an issue for this.
For the nested key, I'll take a look when I have some free time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants