Jan 02, 2025 #tech
5 min read

Custom Markdown Components

Go Scala Elixir

This post tests all the custom markdown components available in this blog 🔥.

Keyboard Shortcuts

You can display keyboard shortcuts inline. Press Cmd+K to open search, or use Ctrl+Shift+P for the command palette.

Common shortcuts:

YouTube Embeds

Embed YouTube videos with a simple shortcode. Use [center] for smaller or [full] for full width:

Video thumbnail
Video thumbnail

Images with Captions

Display images with proper figure/figcaption markup:

Profile avatar
My profile picture used across the site

You can also use it without a caption:

Just an avatar

Alignment Options

Control image alignment with [left], [center], or [full]:

Left aligned
This image is left-aligned

Centered
This image is centered (default)

Full width
This image takes full container width

Image Grid

Display multiple images side-by-side with ::grid. Use ::grid[60%] to set width, and wrap with ::center to center:

First image
Second image

Code Block

type Config struct {
BaseURL string
PublicPath []string
PrivatePath []string
}
var wg sync.WaitGroup
wg.Add(len(config.PublicPath))
for _, path := range config.PublicPath {
go func(p string) {
defer wg.Done()
checkEndpoint(p, true)
}(path)
}
wg.Wait()

😄

Code Tabs

Show the same example in multiple languages with a tabbed interface:

func hello() {
fmt.Println("Hello, World!")
}
def hello(): Unit = {
println("Hello, World!")
}
def hello do
IO.puts("Hello, World!")
end

File Trees

Display directory structures with syntax highlighting:

React App
my-project
src
components
Button.tsx
Input.tsx
Modal.tsx
pages
index.tsx
about.tsx
styles
global.css
config
settings.json
package.json
README.md

Another example with an Elixir project:

Elixir Project
lib
my_app
router.ex
endpoint.ex
my_app.ex
mix.exs
config
config.exs
dev.exs
prod.exs

Comparison Tables

Display tables with winner highlighting for comparisons:

Framework Build Time
Vite 0.5s
Webpack 3.2s
Parcel 2.1s

The first data row is automatically highlighted as the "winner" with green styling.

Callout Boxes

Display notes, warnings, and tips:

This is a note with important information that readers should be aware of.

Be careful with this approach as it may have unintended side effects.

Pro tip: use this pattern for better performance in production.

Collapsible Sections

Hide content that can be expanded on click:

Show implementation details

This content is hidden by default. You can put code examples, lengthy explanations, or optional information here.

It supports markdown formatting inside too, including badges: Elixir OTP 26

Terminal Output

Display command-line interactions:

❯ mix compile
Compiling 5 files (.ex)
warning: variable "foo" is unused
** (CompileError) undefined function bar/0
Custom orange with hex
Info: Build completed

Quotes with Attribution

Simple made easy.

Rich Hickey

The best way to predict the future is to invent it.

Alan Kay

Diff Blocks

Show code changes with additions and removals:

def hello(name) do  IO.puts("Hello #{name}")enddef hello(name, greeting \\ "Hello") do  IO.puts("#{greeting}, #{name}!")  :okend

Badges

Inline labels for versions and status: v2.0.0 deprecated beta new

You can also use plain badges: MIT License TypeScript

Language Badges

Display programming languages with their icon and brand color:

Rust Go Python TypeScript JavaScript Elixir

More languages:

Java Scala Ruby Swift Kotlin C# C++ C PHP

Haskell Clojure Erlang Zig

DevOps & Infrastructure:

DockerDocker KubernetesKubernetes TerraformTerraform AnsibleAnsible HelmHelm PrometheusPrometheus GrafanaGrafana NGINXNginx

Databases:

RedisRedis PostgreSQLPostgreSQL MySQLMySQL MongoDBMongoDB ElasticsearchElasticsearch RabbitMQRabbitMQ

Cloud:

AWSAWS Microsoft AzureAzure Google CloudGCP

Tooltips

Inline hover definitions for technical terms: Working with IAM policies in K8s clusters requires understanding RBAC.

Mermaid Diagrams

Flowcharts and diagrams rendered inline:

graph LR A[Request] --> B{Auth?} B -->|Yes| C[Process] B -->|No| D[401] C --> E[Response]

Sequence diagrams:

sequenceDiagram participant Client participant API participant DB Client->>API: GET /users API->>DB: SELECT * FROM users DB-->>API: Results API-->>Client: JSON Response

GitHub Gist

Embed GitHub Gists with syntax highlighting:

Stats Cards

Display metrics with prominent values. Use ::grid for full-width grid:

99.9% Uptime
1.2M Downloads
<50ms Response Time
24/7 Support

Or use inline for individual stats:

42 Answer

Link Cards

Rich link previews for external resources. Use ::grid for side-by-side:

Image Comparison

Drag to compare before and after images:

After After
Before Before

Steps

Display step-by-step instructions with numbered indicators:

1 Download the installer from the official website Required
2 Run the installer and follow the prompts 5 min
3 Restart your computer when complete Optional
4 Verify installation by running `elixir --version` Terminal

Timeline

Display chronological events with a vertical timeline:

Senior Engineer 2024

Joined the platform team Elixir K8s

Software Engineer 2023

Built the real-time notification system Phoenix

Junior Engineer 2022

Started career Elixir PostgreSQL

Intern 2021

First exposure to functional programming

Combining Components

You can use these alongside regular markdown:

Pro tip: Use Cmd+Shift+F to search across all files in your project.

Install dependencies with Cmd+Shift+P and select "Install". Requires Node 18+ or Bun.

This feature is beta and requires v2.0.0. Press Cmd+K to enable experimental mode.

Version compatibility

Supported runtimes: Node 18+ Deno Bun

Use Cmd+Shift+V to check your current version.

Dividers

Horizontal rules with centered text:

Section Break

Some content between dividers.

Next Chapter

Highlights

Mark important text in your content. You can also use colors:

Small Caps

Use small caps for abbreviations like HTML, CSS, and API. They work great for acronyms like REST or GraphQL.

Tweet Embed

Video tweet:

Text only tweet:

Image tweet:

What a nice Christmas Present from my friends. You know I love Elixir! @elixircards Amazing cards! Merry Christmas to everyone! #myelixirstatus
Tweet image
esc