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

docs: update bindings with default value #2397

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/content/2.usage/2.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ In addition to mdc components and `span`, attribute syntax will work on images,

## Binding Data in Markdown

You can bind data within your Markdown document using the `{{ $doc.variable }}` syntax. These values can be defined in the YAML front matter at the top of the document, within each MDC component, or injected using the `data` prop of the `<ContentRendererMarkdown>` component.
You can bind data within your Markdown document using the `{{ $doc.variable || 'defaultValue' }}` syntax. These values can be defined in the YAML front matter at the top of the document, within each MDC component, or injected using the `data` prop of the `<ContentRendererMarkdown>` component.

### Example 1: Define in YAML

Expand All @@ -471,7 +471,7 @@ description: 'meta description of the page'
customVariable: 'Custom Value'
---

# The Title is {{ $doc.title }} and customVariable is {{ $doc.customVariable }}
# The Title is {{ $doc.title }} and customVariable is {{ $doc.customVariable || 'defaultValue' }}

```

Expand All @@ -493,7 +493,7 @@ const mdcVars = ref({ name: 'Maxime'});

```md

# Hello {{ $doc.name }}
# Hello {{ $doc.name || 'World' }}

```

Expand Down