Modernize Docs UI with Tailwind, Dark Mode, and Improved Layout#3814
Modernize Docs UI with Tailwind, Dark Mode, and Improved Layout#3814UziTech merged 15 commits intomarkedjs:masterfrom
Conversation
|
@samarJ19 is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @samarJ19, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly overhauls the documentation page for the MarkedJS website, transforming its appearance and functionality. The core objective is to deliver a modern, visually appealing, and highly usable experience for users. This is achieved through a comprehensive migration to Tailwind CSS, the introduction of a seamless dark mode, and a general improvement in layout and interactive elements. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request modernizes the documentation page for the MarkedJS website using Tailwind CSS, improves layout and readability, and implements dark mode support. The changes include refactoring the HTML structure, adding Tailwind CSS configuration, updating CSS styles, and modifying JavaScript for theme toggling and other functionalities. I have provided comments to address potential issues related to accessibility, code clarity, and styling consistency.
| id="theme-toggle" | ||
| aria-label="Toggle dark mode" | ||
| class="flex items-center gap-2 px-4 py-2 rounded-lg text-subtle-light dark:text-subtle-dark hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" | ||
| > | ||
| <span class="material-icons dark:hidden">dark_mode</span> | ||
| <span class="dark:hidden text-sm font-medium">Dark Mode</span> | ||
| <span class="material-icons hidden dark:inline">light_mode</span> | ||
| <span class="hidden dark:inline text-sm font-medium" | ||
| >Light Mode</span | ||
| > | ||
| </button> |
There was a problem hiding this comment.
This button uses both text and an icon to convey its meaning. To ensure accessibility, it's important to provide a text alternative for the icon, especially for users who rely on screen readers. Consider using visually hidden text within the span to provide a descriptive label for screen readers.
For example:
<span class="sr-only">Toggle dark mode</span>This will make the button more accessible to users with disabilities.
| .hljs-comment, | ||
| .hljs-code, | ||
| .hljs-formula { | ||
| /* prettylights-syntax-comment */ | ||
| color: #6a737d; | ||
| color: var(--subtle-text-color); |
| copyButton.className = | ||
| 'absolute top-2 right-2 p-2 rounded-md bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity'; |
There was a problem hiding this comment.
This class name is quite long and specific. While it's good to be descriptive, consider if there's a more concise way to express this styling, perhaps by combining some of these classes or using a more general class name that still accurately reflects the button's appearance.
Also, ensure that the contrast ratio between the text and background colors meets accessibility standards, especially in both light and dark modes.
| copyButton.onclick = function() { | ||
| // Exclude the button's own text from being copied | ||
| const code = pre.querySelector('code').innerText; | ||
| navigator.clipboard.writeText(code); | ||
|
|
||
| hashChange(); | ||
| copyButton.innerHTML = '<span class="material-icons text-sm">done</span>'; | ||
|
|
||
| document.addEventListener('DOMContentLoaded', function() { | ||
| const div = document.createElement('div'); | ||
| div.innerHTML = '<div class="tooltip-copy"><img src="/img/copy-icon.svg" class="icon-copy" title="Click to Copy" /></div>'; | ||
| div.className = 'div-copy'; | ||
|
|
||
| const allPres = document.querySelectorAll('pre'); | ||
| allPres.forEach(function(pre) { | ||
| let timeout = null; | ||
| const copy = div.cloneNode(true); | ||
| pre.appendChild(copy); | ||
| pre.onmouseover = function() { | ||
| copy.classList.add('active'); | ||
| }; | ||
| pre.onmouseleave = function() { | ||
| clearTimeout(timeout); | ||
| copy.classList.remove('active'); | ||
| copy.classList.remove('click'); | ||
| }; | ||
| copy.onclick = function() { | ||
| navigator.clipboard.writeText(pre.textContent); | ||
| copy.classList.add('click'); | ||
| clearTimeout(timeout); | ||
| timeout = setTimeout(function() { | ||
| copy.classList.remove('click'); | ||
| }, 3000); | ||
| copyButton.innerHTML = | ||
| '<span class="material-icons text-sm">content_copy</span>'; | ||
| }, 2000); | ||
| }; |
There was a problem hiding this comment.
Consider adding a comment explaining why the timeout is set to 2000ms. This will help future developers understand the reasoning behind this value and make informed decisions if they need to adjust it.
For example:
// Timeout set to 2000ms to allow sufficient time for the 'done' icon to be visible before reverting.|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
UziTech
left a comment
There was a problem hiding this comment.
- Looks like light/dark mode is broken on the demo site
- Light/Dark mode changes aren't saved
- The github banner doesn't change colors on light/dark mode changes
samarJ19
left a comment
There was a problem hiding this comment.
fixes : 1. light/dark mode of demo page
2. Light/Dark mode changes are now getting saved
3. The github banner change colors on light/dark mode changes
samarJ19
left a comment
There was a problem hiding this comment.
fixed linting errors
UziTech
left a comment
There was a problem hiding this comment.
Can we do something with mobile? Maybe hide the nav in a button and make the main part full width?
UziTech
left a comment
There was a problem hiding this comment.
Most of the links in the navigation don't work
samarJ19
left a comment
There was a problem hiding this comment.
Fixed the broken links of nav bar
UziTech
left a comment
There was a problem hiding this comment.
A couple more issues:
- When dark mode is on any time the page changes there is a bright flash.
- The urls for the pages changed so any links to the documentation will be broken.
samarJ19
left a comment
There was a problem hiding this comment.
- Fixed Dark Mode Flash on Page Navigation
Added an inline script in that runs before any CSS/JS loads to apply the .dark class synchronously based on localStorage or system preference. This prevents the bright white flash that occurred when navigating between pages in dark mode.
Technical detail: The theme is now applied before first paint instead of after DOM load, eliminating the FOUC (Flash of Unstyled Content).
- Preserved Backwards Compatibility for Documentation URLs
Modified build.js to generate both URL formats for each page:
New format: using_pro.html, using_advanced.html, etc.
Clean URL format: using_pro/index.html, using_advanced/index.html, etc.
This ensures existing external links and bookmarks (e.g., /using_pro, /using_pro#renderer) continue to work without breaking, while new relative links (.html extensions) also function correctly.
Result: Zero breaking changes for existing documentation links across the web.
UziTech
left a comment
There was a problem hiding this comment.
Looks like the demo still has the flash in dark mode
samarJ19
left a comment
There was a problem hiding this comment.
Fixed demo page dark mode problem, by adding a centralized dark mode theme variable
UziTech
left a comment
There was a problem hiding this comment.
This looks great! Thank you! 💯
samarJ19
left a comment
There was a problem hiding this comment.
Implemented requested changes
There was a problem hiding this comment.
Is anything changing in this file or is it just formatting?
And if its just formatting, why is the formatting changing?
Seems we either have a bug that isn't formatting this file or your IDE has different formatting than this repo.
There was a problem hiding this comment.
Have fixed my prettier configuration (disabled it), now it should not have any formatting issue
There was a problem hiding this comment.
I still see this file is changed. Can you revert?
There was a problem hiding this comment.
Yes you were right , there were few stylistic changes that I have made but they do not add anything to project so I have reverted the build file to its original state, made sure that tests are running and all the other features are also running as they should. Kindly check the latest commit and also check the horizontal scrollbar issue you were talking about
samarJ19
left a comment
There was a problem hiding this comment.
Fixes menubar and horizontal scrollbar problem by increasing the width of breakpoints
samarJ19
left a comment
There was a problem hiding this comment.
Reverted build.js
|
@samarJ19 I just realized this is no longer respecting the system theme when I have my system set to dark mode and visit https://marked.js.org I also confirmed I don't have any cookies set. |
|
hey @styfle I have fixed the initial system preference error in my latest PR so please check it out |





Fixes #3796
Marked version:
Markdown flavor: CommonMark | GitHub Flavored Markdown | Markdown.pl | n/a
Description
This PR modernizes the documentation page for the MarkedJS website:
Refactors the docs UI using Tailwind CSS for a clean, modern look.
Improves layout spacing, section alignment, and overall readability.
Implements dark mode support with proper styling for code blocks and prose.
Simplifies the responsive design, removing unnecessary complexity while maintaining accessibility.
Ensures the GitHub corner banner is always visible and correctly positioned.
Refactors JavaScript for navigation highlighting, theme toggling, and copy-to-clipboard functionality.
Fixes all ESLint errors and passes linting and style checks.
Preserves the original docs structure while enhancing the user experience.
Adds screenshots of the new UI for visual reference.
Result
The documentation page now features a visually appealing, modern design with improved usability and accessibility. All code changes pass existing tests and linting requirements.
Contributor
No new tests required for this PR (UI/UX changes only).
All code changes are documented and follow project conventions.
Committer
CI is green.
Ready for squash and merge following conventional commit guidelines.
Screenshots: