MD-Juice

November 18, 2025 · View on GitHub

Overview

A drop-in CSS theme for rendered Markdown HTML.
Works with any framework, any renderer, or plain HTML. Two layers of customization let you theme quickly, fine-tune individual elements, or simply keep the default GitHub-like look.

Captura de pantalla 2025-09-18 162047 Captura de pantalla 2025-09-18 162102

Table of Contents

Why MD-Juice?

Quickly style Markdown HTML with conflict-free, framework-agnostic CSS.

Use cases: Docs, blogs, wikis, notes apps, README previews, static sites
Key benefits: Fast theming, framework-agnostic, conflict-free styling
Features: GitHub-like default style, zero JS, built-in light/dark themes

Getting Started

Installation

To get started, install MD-Juice:

npm install @aruidev/md-juice

Basic setup

Import Styles

Import the MD-Juice CSS to your global styles.

@import '@aruidev/md-juice';

Basic usage

Quick example

These high-level tokens control the overall look and feel:

.md-juice {
  --juice-color-bg: #fefefe;
  --juice-color-text: #2d2a3e;
}

Dark Mode Support

Add dark mode variants in the same CSS file:

.md-juice[data-theme="dark"] {
  --juice-color-bg: #1a1625;
  --juice-color-text: #e4e2f0;
}

Theming

Layer 1 – Fast tokens (--juice-*)

These high-level tokens control the overall look and feel.
Set these to theme quickly.

TokenLight defaultDark defaultRole
--juice-color-bg#ffffff#0d1117Base background
--juice-color-bg-alt#f6f8fa#010409Secondary surface (tables, panels)
--juice-color-text#1f2328#c9d1d9Primary text
--juice-color-text-secondary#59636e#8b949eMuted text
--juice-color-border#d1d9e0rgba(110,118,129,0.40)Borders / rules
--juice-color-interactive#0969da#58a6ffLinks & accent base
--juice-color-accentvar(--juice-color-interactive)var(--juice-color-interactive)Focus / accent alias
--juice-color-surface-codevar(--juice-color-bg-alt)var(--juice-color-bg-alt)Code blocks & inline code

Typography & layout primitives

TokenDefaultMaps to granularPurpose
--juice-font-family-basesystem stack--mdj-font-familyBase text font stack
--juice-font-family-monospacemonospace stack--mdj-monospaceCode / monospace font stack
--juice-font-size-base16px--mdj-font-sizeRoot font size (affects rem)
--juice-line-height-base1.5--mdj-line-heightGlobal line height
--juice-radius-base6px--mdj-radiusShared corner radius (code, kbd, etc.)
--juice-transition150ms--mdj-transitionTheme transition duration
--juice-transition-timingcubic-bezier(0.4, 0, 0.2, 1)--mdj-transition-timingTheme transition timing

Layer 2 – Granular tokens (--mdj-*)

Override only when a specific surface must differ from the fast mapping.

TokenDefault (maps from fast layer)Description
--mdj-background-color--juice-color-bgPage / main background
--mdj-background-secondary-color--juice-color-bg-altAlt surface
--mdj-text-primary-color--juice-color-textMain text
--mdj-text-secondary-color--juice-color-text-secondaryMuted text
--mdj-border-color--juice-color-borderBorders & dividers
--mdj-link-color--juice-color-interactiveLinks
--mdj-accent-color--juice-color-accentAccent & focus
--mdj-code-bg--juice-color-surface-codeCode block / inline background
--mdj-kbd-bg--juice-color-surface-code<kbd> background
--mdj-kbd-border--juice-color-border<kbd> border
--mdj-mark-bg--juice-color-bg-alt<mark> highlight
--mdj-table-th-bg--juice-color-bg-altTable header
--mdj-table-tr-bg--juice-color-bgTable rows
--mdj-font-familysystem stackBase font
--mdj-monospacemonospace stackCode font
--mdj-font-size16pxRoot font size
--mdj-line-height1.5Base line height
--mdj-radius6pxRadius (pre/code/kbd)
--mdj-hr-height1pxRule thickness
--mdj-focus-outline2px solid var(--mdj-accent-color)Focus style
--mdj-muted-bgtransparentReserved token
--mdj-transition150msTheme transition speed
--mdj-syntax-*fixed colorsMinimal syntax hues

Transitions

By default MD-Juice uses Tailwind's default transition values (150ms + cubic-bezier(0.4,0,0.2,1)) so it visually blends into projects already using Tailwind.

If the rest of your app (e.g. layout, buttons) uses a different speed/easing and you notice a mismatch, just override after loading the stylesheet.

Set --juice-transition and --juice-transition-timing to match your app:

.md-juice { --juice-transition: 200ms; }
.md-juice { --juice-transition-timing: ease-in-out; }

Disable transitions:

You can also disable transitions completely:

.md-juice { --juice-transition: 0ms; }

Tailwind compatibility

  • Works side-by-side with Tailwind.
  • MD-Juice styles only the markdown body inside a .md-juice scope.
  • Load it after Tailwind if you want MD-Juice to take precedence for Markdown.

Syntax highlighting

  • MD-Juice provides only minimal syntax tokens.
  • For full dynamic language highlighting, use a syntax highlighter alongside MD-Juice.
  • You can still override individual --mdj-syntax-* for custom hues.

Enjoy rapid theming. Issues & PRs welcome.