Skip to content

Error render when using variable in markdown block #1289

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

Closed
boojack opened this issue Jun 26, 2022 · 6 comments
Closed

Error render when using variable in markdown block #1289

boojack opened this issue Jun 26, 2022 · 6 comments

Comments

@boojack
Copy link

boojack commented Jun 26, 2022

Environment

https://content.nuxtjs.org/playground

Reproduction

Move variable block {{ $doc.title }} into markdown block, then the render result will be unwanted.

Describe the bug

image

Additional context

No response

Logs

No response

@farnabaz
Copy link
Member

Thanks for reporting the issue, note that:

  • It is not possible to have space characters in markdown links. This is the default behavior of markdown parsers.
  • For now, it is only possible to use variable blocks inside text flow and not in links
# {{ $doc.title}}

{{ $doc.title}}

> {{ $doc.title}}

- {{ $doc.title}}

[{{ $doc.title }}]

[{{ $doc.title}}](/link)

@boojack
Copy link
Author

boojack commented Jun 27, 2022

Can we replace the variables in the raw content before using markdown parser? 🤔️

@farnabaz
Copy link
Member

The content module does not replace variables, it evaluates them at render time. With this approach, let's say you can use the $route variable in your markdown, which will change based on the URL you are visiting.

Your are visiting: {{ $route.path }}

@boojack
Copy link
Author

boojack commented Jun 28, 2022

Got that, thanks for your reply.

@boojack boojack closed this as completed Jun 28, 2022
@ManasMadrecha
Copy link

@farnabaz These $route.path or $doc.xx variables don't work while using them as props for Vue components in markdown, even when prop is written as :prop.

Any workaround?

@ManasMadrecha
Copy link

Found it #1266 (comment)

@boojack boojack closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants