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 opt-in of page rendering, instead of opt-out #162

Closed
fralau opened this issue Apr 22, 2023 · 7 comments
Closed

Allow opt-in of page rendering, instead of opt-out #162

fralau opened this issue Apr 22, 2023 · 7 comments
Labels
fixed A fix has been submitted

Comments

@fralau
Copy link
Owner

fralau commented Apr 22, 2023

Large projects sometimes have too many pages, to allow them to change them all.

In those cases, it would be easier to render only the pages that require it.

See PR (not used): #159 (comment)

@fralau fralau added the planned This is planned for correction label Apr 22, 2023
@fralau
Copy link
Owner Author

fralau commented Apr 22, 2023

Opt-in

The solution will be to use in the header:

---
# YAML header
render_macros: true
---

Opt-in is set in the config file, by specifying that no page will be rendered by default:

plugins:
  - search
  - macros:
      render_by_default: false

Opt-out

This is the default case. If you want to be explicit, you can set the parameter render_by_default to true, in the config file.

In the page, use the following directive:

---
# YAML header
render_macros: false
---

This one will be maintained for compatibility (deprecated):

---
# YAML header
ignore_macros: true
---

@attie
Copy link

attie commented Apr 22, 2023

Would you like me to rework the PR?

@fralau
Copy link
Owner Author

fralau commented Apr 22, 2023

@attie Thanks! Actually I just implemented and tested it as I went. I should be able to push it today - few lines of code.

Most of the work is was testing and documentation. But you can be credited with the idea!

fralau pushed a commit that referenced this issue Apr 22, 2023
  - Document opt-in and various fixes of documentation
  - Demote `macro_info()` (start with header of level 2), #123
@fralau
Copy link
Owner Author

fralau commented Apr 22, 2023

@attie @hexus This is pushed, if you wish you can started to test if that works for you?

@fralau fralau added fixed A fix has been submitted and removed planned This is planned for correction labels Apr 22, 2023
@attie
Copy link

attie commented Apr 24, 2023

@fralau Perfect, thanks very much! Any idea when you plan to push to PyPi? (no hurry, I'd just like to know so I can drop the git reference)

@hexus
Copy link

hexus commented Apr 25, 2023

Works well for me too, @fralau. Cheers!

I wasn't particularly in need of this global override for my current project, just offering my two cents on #159. ☺️

Nice to have though, and I think it'll be useful for future projects.

@fralau
Copy link
Owner Author

fralau commented Apr 25, 2023

Thanks to both of you, for your input and for testing!

That's part of the 1.0.0 project, and I will push it to pypi as soon as it is ready. The more people test it, the better it is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed A fix has been submitted
Projects
None yet
Development

No branches or pull requests

3 participants