Skip to content

feat: make it possible to disable tabs via frontmatter#27

Open
MarkoSagadin wants to merge 1 commit intoMochitto:mainfrom
MarkoSagadin:feature/no_tabs
Open

feat: make it possible to disable tabs via frontmatter#27
MarkoSagadin wants to merge 1 commit intoMochitto:mainfrom
MarkoSagadin:feature/no_tabs

Conversation

@MarkoSagadin
Copy link
Collaborator

With this change is now possible to disable presence of tabs, by adding the below frontmatter snippet to the top of the markdown file:


no_tabs: True

If present then:

  • 'L', 'R', '-', '+' tab flags are ignored, only 'F' and 'B' matter.
  • Tab labels don't matter

To avoid possible styling interference two new classes were created: body and body__content. They are a direct copy of the tab__body and tab__body_content classes, only that their display property is set to 'flex' instead of none.

The python code now generates the html out of markdown as it would normally and wraps content in the above two mentioned containers. That way no tab-related styling is present.

Finally, all the changes in the main.ts make the presence of the .tab_group selector optional. If not found then no extra logic is enabled and content is present on single page.


Take this as a work in progress. The functionality is there, but there are definitely things that could be better placed or done differently. Also, some things should probably be better documented.

Please point out what needs to be improved or changed.

Copy link
Owner

@Mochitto Mochitto left a comment

Choose a reason for hiding this comment

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

The change looks good; added a comment on the name of the added classes :)

Might also want to add the option to the README and the CHANGELOG so users can get to know and use this feature in the next release.

max-width: 70vw
padding: 35px 25px

.body
Copy link
Owner

Choose a reason for hiding this comment

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

I think .card-body could be better; there's a tag in HTML and it could look like we are styling that, instead of styling the card itself :)

Avoid .card as that's a reserved class used by anki

@MarkoSagadin
Copy link
Collaborator Author

I have renamed the CSS class and added entries to README and CHANGELOG.

Tell me what you think :)

@MarkoSagadin
Copy link
Collaborator Author

I have rebased this branch on the main and forced pushed the changes.

I see that the build workflow is failing due to the deprecated action. I have opened a PR #30 fixes that.

So that PR needs to be merged first, then I re-base again and then this can finally be merged.

@MarkoSagadin MarkoSagadin force-pushed the feature/no_tabs branch 3 times, most recently from b857b42 to 60c796f Compare February 27, 2025 20:57
With this change is now possible to disable presence of tabs, by adding
the below frontmatter snippet to the top of the markdown file:

---
no_tabs: True
---

If present then:
- 'L', 'R', '-', '+' tab flags are ignored, only 'F' and 'B' matter.
- Tab labels don't matter

To avoid possible styling interference two new classes were created:
body and body__content. They are a direct copy of the  tab__body and
tab__body_content classes, only that their display property is set to
'flex' instead of none.

The python code now generates the html out of markdown as it would
normally and wraps content in the above two mentioned containers.
That way no tab-related styling is present.

Finally, all the changes in the main.ts make the presence of the
.tab_group selector optional. If not found then no extra logic is
enabled and content is present on single page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants