Skip to content

Commit

Permalink
docs: update bindings with default value (#2397)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximepvrt committed Oct 25, 2023
1 parent c675258 commit 4dab9b2
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 4dab9b2

Please sign in to comment.