-
Notifications
You must be signed in to change notification settings - Fork 138
docs: add custom CSS usage and warnings to user guide (#2705) #2736
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds documentation to the user guide explaining how users can implement custom CSS styling in MarkBind sites. The documentation covers both site-wide and page-specific styling approaches with practical examples and important warnings about potential conflicts with built-in component styles.
{% from "njk/common.njk" import previous_next %} | ||
{{ previous_next('components/advanced', 'tweakingThePageStructure') }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation section is incomplete. The PR description mentions explaining two methods (site-wide and page-specific inline styles) with warnings about conflicts, but only the site-wide method is documented. The page-specific inline <style> blocks method and the promised warnings about conflicts with MarkBind's built-in component styles are missing.
> **Warning:** Custom CSS rules may conflict with MarkBind's built-in component styles. If you override styles used by MarkBind components (e.g., buttons, panels, etc.), it may affect their appearance or functionality. Use specific selectors or [CSS scoping techniques](https://developer.mozilla.org/en-US/docs/Web/CSS/Scope) to minimize conflicts. | |
### 2. Add page-specific inline styles | |
To apply styles to a single page, you can add a `<style>` block directly in your `.md` file. For example: | |
```html | |
<style> | |
.custom-title { | |
color: darkblue; | |
font-size: 2em; | |
} | |
</style> | |
<h1 class="custom-title">Welcome to My Page</h1> |
This method is useful for quick customizations or when you want to style only a specific page.
Warning: Inline styles can also conflict with MarkBind's built-in component styles. If you use generic selectors (e.g.,
h1
,.panel
), you may unintentionally override styles used by MarkBind components. Prefer using unique class names to avoid such conflicts.
{% from "njk/common.njk" import previous_next %}
{{ previous_next('components/advanced', 'tweakingThePageStructure') }}
Copilot uses AI. Check for mistakes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2736 +/- ##
=======================================
Coverage 52.84% 52.84%
=======================================
Files 130 130
Lines 7162 7162
Branches 1591 1596 +5
=======================================
Hits 3785 3785
Misses 3072 3072
Partials 305 305 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @arshinsikka, thanks for the contribution. As mentioned by Copilot, it would be good to include a warning to users about the use of custom css as it may conflict with MarkBind's default css, leading to unexpected behavior. You also mentioned "two common ways" but only included one way 😅 Regarding the site-wide custom stylesheet you mentioned, I wasn't able to get it to work using those instructions. Its possible that this method of adding custom css isn't actually implemented by MarkBind yet as the user guide doesn't seem to mention "head" being a possible config option for |
What is the purpose of this pull request?
Overview of changes:
Adds a new section titled "Using Custom CSS in MarkBind" at the bottom of usingHtmlJavaScriptCss.md
Explains two methods to add custom styles:
Site-wide styles using site.json
Page-specific inline <style> blocks
Includes warnings about conflicts with MarkBind’s built-in component styles
Provides code examples and best practices
Anything you'd like to highlight/discuss:
The section was added just before the {% previous_next %} block to maintain structure
IntelliJ may show false warnings (e.g., unrecognized tags), but site renders fine
Let me know if you'd like it moved to a different file or split out for better discoverability
Testing instructions:
Serve the site locally:
npx markbind serve packages/core/docs/userGuide
Navigate to "Using HTML, JavaScript, CSS" in the user guide sidebar
Scroll to the bottom and verify:
Proposed commit message: (wrap lines at 72 characters)
docs: add custom CSS usage and warnings to user guide (#2705)
Adds documentation to explain how users can add site-wide or inline
custom CSS in MarkBind. Also includes best practices and warnings
about overriding MarkBind's default component styles.
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major
,r.Minor
,r.Patch
.Breaking change release note preparation (if applicable):