bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Docs: Add a way to skip some doc stuff

Open louismaximepiton opened this issue 11 months ago • 2 comments

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)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Refactoring (non-breaking change)
  • [ ] Breaking change (fix or feature that would change existing functionality)

Checklist

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

Live previews

Related issues

#38933.

louismaximepiton avatar Mar 06 '24 15:03 louismaximepiton

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...

XhmikosR avatar Mar 06 '24 16:03 XhmikosR

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.

louismaximepiton avatar Mar 07 '24 07:03 louismaximepiton