Evidence supports almost all Markdown syntax.
---
title: Evidence uses Markdown
---

Markdown can be used to write expressively in text.

- it supports lists,
- **bolding**, _italics_ and `inline code`,
- links to [external sites](https://google.com) and other [Evidence pages](/another/page)

Components

Evidence has a built in component library to create charts and other visual elements. The components use Markdoc syntax.
{% line_chart
    data="demo_daily_orders"
    x="date"
    y="sum(sales)"
    date_grain="month"
%}
The easiest way to add a component is using a slash command, and starting to type the name - press tab to select it.

SQL

Code fences in Evidence markdown pages run queries and return data. These code fences run the ClickHouse SQL dialect.
```sql ten_daily_orders
select * from demo_daily_orders limit 10
```
You can then use the data in your markdown using the data attribute.
{% table
    data="ten_daily_orders"
%}

Inline Query References

You can reference other inline queries within your SQL using the {{query_name}} syntax. The referenced query will be wrapped in parentheses and substituted in place.
```sql top_categories
select category, sum(sales) as total_sales
from demo_order_details
group by category
order by total_sales desc
limit 5
```

```sql category_breakdown
select 
    category,
    item_name,
    sum(sales) as item_sales
from demo_order_details
where category in (select category from {{top_categories}})
group by category, item_sales desc
order by category, item_sales desc
```

Filters

Referencing Filters

You can reference filters in your SQL queries using the {{filter_id.property}} syntax, where filter_id is the id attribute you gave to your filter component. This allows dynamic filtering based on user interactions. All available filters for your page can be found in the Filters tab in the sidebar. Each filter component offers different filter properties. For example, the dropdown component offers a .selected property, a .literal property, and a .filter property. Most input components offer a .filter property, which provides a complete SQL filter expression ready to use inside of a where clause.
Dropdown Example

{% dropdown
    id="category_dropdown"
    data="demo_daily_orders"
    value_column="category" 
/%}

```sql category_analysis
select * from demo_daily_orders 
where {{category_dropdown.filter}}
-- resolves to `where category = 'Electronics'` 
-- if electronics is selected, or 
-- `where true` if no value is selected.
```

Conditional Blocks

Use conditional blocks [[...]] to include SQL clauses only when filters have values:
Conditional Blocks
select * from demo_order_details
where transaction_amount > 500 
[[and category = {{category_dropdown.selected}}]]
The conditional block will only be included if all template variables within it resolve to non-empty values.

Fallback Values

Provide fallback values using the pipe | syntax:
With Fallbacks

select * from demo_order_details
where category = {{category_dropdown.selected | 'Electronics'}}

If the filter value is empty or undefined, the fallback value after the | will be used.