Skip to content

Static tabs macro - Intended to be used with static output#9845

Draft
pmario wants to merge 10 commits into
TiddlyWiki:masterfrom
pmario:vk1-static-tabs-macro
Draft

Static tabs macro - Intended to be used with static output#9845
pmario wants to merge 10 commits into
TiddlyWiki:masterfrom
pmario:vk1-static-tabs-macro

Conversation

@pmario

@pmario pmario commented Apr 29, 2026

Copy link
Copy Markdown
Member

The static tabs macro is mainly intended to be used to render static output, that contains tabs.

The PR contains 4 test tiddlers

  • TestCases/StaticTabs/Pitch ... hopefully more interesting than lorem ipsum ;)
  • TestCases/StaticTabs/test-static-tabs-details
  • TestCases/StaticTabs/test-static-tabs-sections
  • TestCases/StaticTabs/test-static-tabs-vertical

Detailed docs is still missing. Playing with it, prior to publishing, it seems there is a lot more potential, for wikitext use too.

image

pmario added 9 commits April 28, 2026 19:25
Introduces $:/core/macros/static-tabs which renders every tab visibly as a
sequence of

- <section> blocks (default) or
- <details open> blocks, with no $reveal widget, no JS, no state tiddler.

Internal headings auto-demote via tv-adjust-heading-level so tab content nests below the configured section heading level.

Also adds three TestCase tiddlers under TestCases/StaticTabs/ that share a
common SharedSamples compound tiddler via the import-compound field.
Outer call sets tv-static-tabs-depth and tv-static-tabs-mode. Inner
call inherits the mode if none passed, and shifts headingLevel by depth
(capped at h6). SampleTabFour now calls <<static-tabs>> directly to
exercise nested rendering.
The core <<tabs>> macro now delegates to <<static-tabs>> when
tv-config-static is "yes".

static-tabs derived variables use the underscore-prefix convention from the
toc macro header (e.g. headingLevel param resolves to _headingLevel, mode to _mode). Computation chain inside the macro also uses _-prefixed locals
(_levelNum, _ownShift, _parentShift, _shift).
-sections and -details now wrap <<tabs>> in <$let tv-config-static="yes">
(plus tv-static-tabs-mode="details" for the latter). SampleTabFour
reverts to <<tabs>> and inherits via propagation. -auto deleted as
redundant.
- Captions transcluded via `<$transclude field="caption">` so values
  like `{{$:/language/.../Caption}}` resolve to rendered text.
- Default mode flipped to `details`; pass `tv-static-tabs-mode="sections"`
  to override.
- Adds vanilla stylesheet for bordered cards.
- Adds `-vertical` test case; `NestedTabC` now exercises three-level
  nesting via inner `<<tabs>>`.
Setting `tv-config-static-tabs-closed="yes"` makes static-tabs in
details mode emit `<details>` without the `open` attribute, so each
tab renders collapsed by default.

Implemented by splitting `static-tabs-detail` into helper procedures
(`-summary`, `-body`) and building the `<details>` opening as a
backtick-substituted string so the conditional `open` keyword is
inlined into a single tag.
`static-adjust-heading-level` field on a tab tiddler is added to the
auto-derived shift (+/- integer, 0 = unchanged).

`StaticTabs` plus five pitch tabs, with three further tabs
nested under `OneVariable`. Test cases `-details`, `-sections`,
`-vertical` import the new compound and transclude `StaticTabs` via
the modern transclude widget.
@netlify

netlify Bot commented Apr 29, 2026

Copy link
Copy Markdown

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit e2266da
🔍 Latest deploy log https://app.netlify.com/projects/tiddlywiki-previews/deploys/69f16a651478a900087235b2
😎 Deploy Preview https://deploy-preview-9845--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

Confirmed: pmario has already signed the Contributor License Agreement (see contributing.md)

@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown

📊 Build Size Comparison: empty.html

Branch Size
Base (master) 2489.5 KB
PR 2495.7 KB

Diff: ⬆️ Increase: +6.2 KB


⚠️ Change Note Status

This PR appears to contain code changes but doesn't include a change note.

Please add a change note by creating a .tid file in editions/tw5.com/tiddlers/releasenotes/<version>/

📚 Documentation: Release Notes and Changes

💡 Note: If this is a documentation-only change, you can ignore this message.

@pmario pmario marked this pull request as draft April 29, 2026 02:35
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.

1 participant