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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

@@ -110,3 +110,34 @@
@media (min-aspect-ratio: 1/1)
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

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.
@MarkoSagadin
Copy link
Collaborator Author

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

Tell me what you think :)

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