Skip to content

[Bug] Code in markdown files being evaluated, causes dbt build to fail #11837

@pSpitzner

Description

@pSpitzner

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I want to document a macro using markdown, lets say the macro is left.sql,
and I have a markdown file left.md

{% docs macro_left %}


Take the leftmost n characters of a string-column.

# Arguments
- text : string
    The column holding the string, or "'any_static_text'"
- len : integer
    Column holding a number, or a number. Cannot be negative.

# Example
\`\`\`sql
-- text column
select {{ left('text', 10) }} as output

-- static text
select {{ left("'any_static_text'", 10) }} as output
\`\`\`

{% enddocs %}

With the markdown file placed e.g. next to the macro, (and with the sql code block in place) dbt build will fail, complaining the macro left cant be found. Note that in the actual markdown, the triple code tick is not escaped.

It seems that the code inthe markdown file is being compiled during build time.

Expected Behavior

I expected markdown files not to impact dbt build at all.

Steps To Reproduce

  1. create a markdown file
  2. insert some jinja - as you would to demonstrate how to use a macro
  3. dbt build (and most other commands) will fail

Relevant log output

Environment

- OS: macOS 15
- Python: 3.12
- dbt: 1.10.4, also tested on dbt 1.9.2

Additional Context

tested on duckdb adapter

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions