Blog Beautification - Changing the Rendering of Quotes and Code Blocks, Supporting GitHub Alerts

Last updated on April 10, 2026 pm

This article is currently an experimental machine translation and may contain errors. If anything is unclear, please refer to original Chinese version. I am continuously working to improve the translation.

For a long time I've felt that the quotes and code blocks on my blog were hideously ugly, and the lack of support for GitHub Alerts like [!TIPS] was quite annoying. Today I solved these issues one by one.

Solved entirely through Vibe Coding, using Copilot + GPT 5.3 Codex High.

Quote Section

The prompt was roughly to imitate the VitePress style and modify the blockquote part.

The specific file is located at source/css/custom.css, and is imported via custom_css in the theme configuration _config.fluid.yml.

The blockquote changes mainly did three things:

  1. Adjusted the left accent border;
  2. Added rounded corners and a background gradient;
  3. Unified the color variables in dark mode.

For example, the core styles look roughly like this:

:root {
  --vp-like-quote-bg: #f5f9ff;
  --vp-like-quote-border: #3a8ee6;
}

.markdown-body blockquote {
  border-left: 4px solid var(--vp-like-quote-border);
  border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, var(--vp-like-quote-bg), transparent);
}

Code Block Section

The prompt was similar—imitating the VitePress style, then modifying the styles and the code font.

For the code font, I used this set: JetBrains Mono, Fira Code, Cascadia Code, falling back to common monospace fonts.

The key points of the code block style changes:

  1. Unified the border, rounded corners, and background color;
  2. Adjusted the table layout of figure.highlight;
  3. Ensured the layout doesn't break during horizontal scrolling;
  4. Kept the line height and spacing consistent between the line number column and the code column.

Key style example:

.markdown-body figure.highlight {
  border: 1px solid var(--vp-like-code-border);
  border-radius: 12px;
  overflow-x: auto;
}

.markdown-body figure.highlight td.gutter pre,
.markdown-body figure.highlight td.code > pre {
  line-height: 1.75 !important;
}

By LLM:

Regarding code line numbers, I implemented a "double insurance" approach here:

  1. Configuration layer: set the line number related switches to false in both _config.fluid.yml and _config.yml;
  2. Post-rendering processing layer: added scripts/strip-code-gutter.js, which at the after_post_render stage detects line_number: false and proactively removes td.gutter from figure.highlight.

This way, even if some pages still carry a gutter due to historical cache or rendering pipeline differences, it will be stripped out before the final HTML output, ensuring the page appearance is consistent with the configuration.

Handling GitHub Alert Support

I personally don't understand the Markdown parsing process, but while reading the Hexo Fluid Official Documentation, I came across this part:

Description of Tag in the Hexo Fluid documentation

So I wondered whether it would be possible to parse a format like

> [!TIPS]

into a format natively supported by Hexo Fluid?

I fed the above idea to Copilot, and it was written as a JavaScript script scripts\gfm-alert-to-note.js.

Using this mapping:

const ALERT_CLASS_MAP = {
  note: 'info',
  tip: 'success',
  tips: 'success',
  important: 'primary',
  warning: 'danger',
  caution: 'warning'
};

The script's approach is actually quite straightforward:

  1. Get the rendered HTML of the post at after_post_render;
  2. Use cheerio to find all blockquote elements;
  3. Check whether the first line is a marker like [!NOTE] / [!TIP];
  4. Convert the type to Fluid's note-xxx according to the mapping table;
  5. Finally, replace the original blockquote with <div class="note note-xxx">...</div>.

The corresponding implementation file is: scripts/gfm-alert-to-note.js.

Before and After Comparison

Before:

code-format-show
quote-show

After:

code-now-show
quote-now-show

Summary

Actually, today I originally planned to migrate my blog to VitePress (simply because it looks so nice), but I found that I couldn't figure out how to design a suitable file directory structure, or how to properly organize the content, so I've shelved it for now.

Perhaps the next blog update will be "Migrating the Blog to VitePress".


Blog Beautification - Changing the Rendering of Quotes and Code Blocks, Supporting GitHub Alerts
https://blog.wendain.ing/en/posts/beautify-blog-1/
Author
wendaining
Posted on
April 10, 2026
Updated on
April 10, 2026
Licensed under