Skip to content

Comments

Modernize Docs UI with Tailwind, Dark Mode, and Improved Layout#3814

Merged
UziTech merged 15 commits intomarkedjs:masterfrom
samarJ19:master
Nov 10, 2025
Merged

Modernize Docs UI with Tailwind, Dark Mode, and Improved Layout#3814
UziTech merged 15 commits intomarkedjs:masterfrom
samarJ19:master

Conversation

@samarJ19
Copy link
Contributor

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:

Screenshot 2025-10-21 210753 Screenshot 2025-10-21 210802

@vercel
Copy link

vercel bot commented Oct 21, 2025

@samarJ19 is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • UI Modernization: The documentation UI has been completely refactored using Tailwind CSS, resulting in a clean and modern aesthetic.
  • Dark Mode Implementation: Full dark mode support has been added, including proper styling for code blocks and prose content.
  • Improved Layout and Readability: The overall layout, spacing, and section alignment have been enhanced for better readability and user experience.
  • Simplified Responsive Design: The responsive design has been streamlined, removing unnecessary complexity while maintaining accessibility.
  • Persistent GitHub Corner: The GitHub corner banner is now consistently visible and correctly positioned across different views.
  • JavaScript Refactoring: Key JavaScript functionalities, such as navigation highlighting, theme toggling, and copy-to-clipboard, have been refactored for improved performance and maintainability.
  • Code Quality: All ESLint errors have been addressed, and the codebase now passes linting and style checks.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +386 to 396
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>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

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.

Comment on lines 51 to +54
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #6a737d;
color: var(--subtle-text-color);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Consider defining these color variables (subtle-text-color) within the root and dark sections to ensure consistency with the other color definitions. This will make it easier to maintain and update the color scheme in the future.

Comment on lines +42 to +43
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';
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Comment on lines 51 to 63
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);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

@vercel
Copy link

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marked-website Ready Ready Preview Comment Nov 9, 2025 9:12pm

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

  1. Looks like light/dark mode is broken on the demo site
  2. Light/Dark mode changes aren't saved
  3. The github banner doesn't change colors on light/dark mode changes

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

fixed linting errors

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

Can we do something with mobile? Maybe hide the nav in a button and make the main part full width?

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

I have added mobile responsive design, kindly review it
Screenshot 2025-10-23 134902
Screenshot 2025-10-23 134910

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

Most of the links in the navigation don't work

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

Fixed the broken links of nav bar

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

A couple more issues:

  1. When dark mode is on any time the page changes there is a bright flash.
  2. The urls for the pages changed so any links to the documentation will be broken.

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

  1. 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).

  1. 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.

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

Looks like the demo still has the flash in dark mode

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

Fixed demo page dark mode problem, by adding a centralized dark mode theme variable

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

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

This looks great! Thank you! 💯

@styfle
Copy link
Member

styfle commented Nov 4, 2025

  1. Clicking the hamburger icon doesnt do anything on desktop. Perhaps it should be hidden?
  2. Clicking on headers no longer works
image

@styfle
Copy link
Member

styfle commented Nov 4, 2025

  1. Clicking this link is incorrectly linking to /using_advanced.html#extensions instead of the correct /using_advanced#extensions
image

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

Implemented requested changes

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have fixed my prettier configuration (disabled it), now it should not have any formatting issue

Copy link
Member

Choose a reason for hiding this comment

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

I still see this file is changed. Can you revert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

@styfle
Copy link
Member

styfle commented Nov 6, 2025

Nit pick: when I have a device at 775px width, I still see the menu and have to use a horizontal scrollbar.

Perhaps the menubar shouldn't be visible until 1024px wide or greater.

image

Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

Fixes menubar and horizontal scrollbar problem by increasing the width of breakpoints

@samarJ19 samarJ19 requested a review from styfle November 6, 2025 20:16
Copy link
Contributor Author

@samarJ19 samarJ19 left a comment

Choose a reason for hiding this comment

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

Reverted build.js

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

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

Great work, thanks! 🎉

@UziTech UziTech merged commit 23b9d01 into markedjs:master Nov 10, 2025
7 checks passed
@styfle
Copy link
Member

styfle commented Nov 13, 2025

@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.

@samarJ19
Copy link
Contributor Author

hey @styfle I have fixed the initial system preference error in my latest PR so please check it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI/UX Redesign for Marked.js Website

3 participants