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

Allow pages to opt-in, instead of opt-out. #159

Closed
wants to merge 1 commit into from

Conversation

attie
Copy link

@attie attie commented Apr 12, 2023

I have many, many pages, but would like to use Jinja2 rendering on only one new page.
This patch will make the ignore_macros configuration available at the global level, effectively permitting individual pages to "opt-in" using ignore_macros: true, instead of only "opt-out" using ignore_macros: false.

@@ -301,6 +301,28 @@ You may, of course, chose the combination that best suits your needs.
of trouble, please do not expect help from the maintainers of this
plugin.

#### Solution 5: Make the rendering process opt-in, instead of opt-out

_From version x.x.x_
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to show here, please feel free to fixup in your own commit!

@hexus
Copy link

hexus commented Apr 21, 2023

permitting individual pages to "opt-in" using ignore_macros: true, instead of only "opt-out" using ignore_macros: false.

You mean this the other way round, right? ignore_macros: false to opt-in, when it's set to true globally. Double-negatives can be confusing. 😁 Oh, I see what you mean. It could be set to ignore_macros: true globally to allow pages to opt-in. I misunderstood the context!

If it were my design, I'd have this config renamed to something like enabled, or enable_macros, set to true globally by default. Then pages could opt-out with enable_macros: false, or inversely you could disable globally in MkDocs config and use enable_macros: true on a page to opt in.

@attie
Copy link
Author

attie commented Apr 21, 2023

Double-negatives can be confusing

Hah...

It could be set to ignore_macros: true globally to allow pages to opt-in.

Yeah, exactly - disable macros globally, and then re-enable them for the pages that need to use macros.

If it were my design

If I was implementing it fom scratch, I would probably have picked upright logic too (rather than inverted)... but I didn't want to disrupt / confuse the ignore_macros that is already present at the page level... This way, we keep a setting (ignore_macros), which can now be set globally, and overridden on a per-page basis.

@fralau
Copy link
Owner

fralau commented Apr 22, 2023

This is attached to issue #162 (a slightly different solution was adopted).

@hexus
Copy link

hexus commented Apr 22, 2023

I really like that solution! 🙌

@fralau
Copy link
Owner

fralau commented Apr 24, 2023

Thanks a lot for your helpful contribution.

@fralau fralau closed this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants