# Macros

Macros, sometimes referred to as snippets, allow you to quickly insert text when you type certain words. You can think of Macros like an in-built text expander.  Type a keyword and pre-defined text is returned.&#x20;

### How to use Macros

It is important to note that there is no UI for Macros, they are instead  defined in config.edn under the `:macros` key.

1. Open your `config.edn` file (search or via settings), and find the `macros:` section.
2. Type the macro name as the first word wrapped in curly braces e.g. the `foo` macro is typed as `{{foo}}`
3. Macros can have arguments configured with dollar variables. For example, the `hello` macro defined as `"Hello $1 and $2!"` has two arguments and is invoked with comma-delimited arguments like `{{hello foo, bar}}`. This results in `Hello foo and bar!`

A few examples are included below:

Define a macro that inserts text at a specific locationCLOJURE1

```
:macros {
    "compare" "This is better than $1 and $2."
    }

```

Define a macro to insert today's date (via a \[\[Dynamic Variable]])CLOJURE1

```
:macros {
    "today" "Today is **<% today %>**"
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unofficial-logseq-docs.gitbook.io/unofficial-logseq-docs/intermediate-to-advance-features/macros.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
