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

[Feature] Support .jinja, .jinja2, .j2 file extensions for .md docs files #11097

Open
3 tasks done
stevenayers opened this issue Dec 5, 2024 · 1 comment
Open
3 tasks done
Labels
enhancement New feature or request help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors

Comments

@stevenayers
Copy link

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

At the moment doc blocks are only detected in .md files. IDEs often support richer syntax highlighting for .md.j2 extension, so it would be great if we could extend dbt core to look in files with this extension too.

Describe alternatives you've considered

Using an .md file instead. It works absolutely fine, would just be a nice usability improvement.

Who will this benefit?

Everybody who loves docs! :))))

Are you interested in contributing this feature?

Yep sure

Anything else?

No response

@stevenayers stevenayers added enhancement New feature or request triage labels Dec 5, 2024
@dbeatty10
Copy link
Contributor

Thanks for proposing this @stevenayers!

This is the Markdown-specific complement to #3484, and I'm going to label this as help_wanted accordingly. A contributor may or may not find it's easiest to implement them both at the same time. Here's the most recent time someone made an attempt at this, which may have give ideas / insight: #3498.

For product refinement

I think we'd want to somehow support a variety of the most popular extensions (.jinja, .jinja2, .j2, etc.) -- see #3484 (comment) for more detail.

I think the following could be a relevant interface for users to opt-in to the relevant file extension(s):

dbt_project.yml

model-paths: [directorypath]
seed-paths: [directorypath]
clean-targets: [directorypath]
template-extensions: [fileextension]

Alternatively, we could choose to take a route similar to copier and only allow configuring a single extension per project: templates_suffix in copier.

Examples

Only allowing a single extension

template-extension: ".j2"

Allowing a list

template-extensions: [".jinja", ".jinja2", ".j2", ".templ", ".etc"]

In both cases, the proposed default would be not recognizing any extensions at all. And configuring a template extension would require all files to use it or not be recognized otherwise. Open to feedback on both of these though!

@dbeatty10 dbeatty10 changed the title [Feature] Support .md.j2 file extension for docs files [Feature] Support .jinja, .jinja2, .j2 file extensions for .md docs files Dec 6, 2024
@dbeatty10 dbeatty10 added help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors and removed triage labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help_wanted Trickier changes, with a clear starting point, good for previous/experienced contributors
Projects
None yet
Development

No branches or pull requests

2 participants