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

Docs: Add a way to skip some doc stuff #39747

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented Mar 6, 2024

Description

Add a {{ skip (.*) }}{{ /skip }} tags to our example to change the displayed code from the executed code.
I couldn't think about it using native Hugo template ({{ if }}, etc.) so I tried to reproduce as mush as possible the syntax.
It might be far from ideal but we could merge a first version and upgrade it with time and experiment.
⚠️ Remove the doc example before merging.
Once this is merged (or equivalent) I'll update all Bootstrap examples to avoid dupe code, uniformize a bit more the documentation and add Stackblitz to all those new examples..
Should it be mentioned somewhere to help contributors discovering this feature ?

Can you think about a better approach to help with this issue ?

Motivation & Context

In context of #38933.
Avoid dupe code.
Help people maintaining only one version of each example and keep the doc tidier.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

#38933.

@XhmikosR
Copy link
Member

XhmikosR commented Mar 6, 2024

I'm not sure I like this approach, but I can't think of a better way right now, though.

The regex seems pretty complex and having to introduce all these {{rendering}} stuff seems suboptimal and messier to just duplicating the code...

@louismaximepiton
Copy link
Member Author

I see your point and I totally agree with you. I'll try to think of another way in the next days.

I forgot to mention it inside the description, but it could also help on uniformization of the documentation and make all examples in the documentation tryable via Stackblitz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants