proomt

Search

Search posts, papers, and topics

All posts

Alex Russell6 min readintermediate

From PrismJS to Better PrismJS to MicroLighter in Three Painless* Steps

Summary

The author describes evolving syntax highlighting on their Eleventy site, starting from the default PrismJS plugin to a custom server-side hack for line numbers. They then detail integrating MicroLighter, a client-side web component, by leveraging Eleventy's bundler for conditional loading and managing content escaping for optimal performance.

  • Eleventy's PrismJS plugin can be extended for line numbers by wrapping lines in `<span>` via a paired shortcode and using CSS counters.
  • Customizing Eleventy's syntax highlighting often requires leveraging paired shortcodes and string manipulation for output control.
  • The 11ty Bundler is crucial for conditionally loading client-side syntax highlighting JS/CSS and preloading language definitions.
  • Integrating client-side web components like MicroLighter into Eleventy requires careful handling of Nunjucks and Markdown content escaping.

Engineers building static sites with Eleventy can learn advanced techniques for customizing syntax highlighting, managing client-side dependencies, and integrating web components for better performance and flexibility.

7/10

Related reading

  1. Fixing Server Component Bundle Leaks in Next.js with AST Linting

    Server‑only code can silently inflate client bundles in Next.js 15+ apps. The article shows how to spot leaks with @next/bundle-analyzer, prevent them by removing shared barrel files or adding the `server-only` guard, and enforce a deny‑list of server modules via a custom ESLint rule that scans the AST of files with a `'use client'` directive. The rule is wired into a CI bundle‑budget check using…

    SitePointsitepoint.com14 min
  2. Beyond jj: config & tools ecosystem

    A talk‑style overview of the growing jj ecosystem, covering new built‑ins (bookmark‑advance, bisect‑run, run, fix, tag, arrange, converge), clever alias tricks (subcommand aliases, git‑push‑like publish alias), the community‑maintained alias directory, and current forge integrations (GitHub stacked PRs, JJHub, Radicle, Tangled).

    Lobstersarko.net16 mintalklobste.rs89