blog

Blog Features Demo


This post demonstrates all the rich features available in this blog.

Contents

1. Images & Lightbox

Click on any image to see the lightbox in action!

Agnes plushie sitting on a desk
Agnes plushie sitting on a desk
Code screenshot with dark theme
Code screenshot with dark theme

2. Syntax Highlighting

We use Expressive Code with the Dracula theme for beautiful code blocks with built-in copy buttons.

Python

hello.py
def hello_world():
print("Hello, World!")
return True
# Call the function
hello_world()

JavaScript

future.js
const future = "web";
console.log(`The future of ${future}`); // This line is highlighted

Terminal

Terminal
npm install astro-expressive-code
npm run dev

3. Math Rendering

Mathematical equations are rendered using KaTeX.

Inline Math: The energy-mass equivalence formula is E=mc2E = mc^2.

Block Math: Here is the Fourier Transform:

f(x)=f^(ξ)e2πiξxdξf(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2\pi i \xi x} \,d\xi

And the quadratic formula:

x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

4. Tables (GFM)

FeatureStatusNotes
Syntax HighlightingExpressive Code
Math EquationsKaTeX
TablesGFM
Task ListsGFM
FootnotesGFM

5. Task Lists

  • Install Astro
  • Add MDX support
  • Configure syntax highlighting
  • Deploy to production
  • Add more blog posts

6. Footnotes

Here’s a sentence with a footnote1. And another one2.


7. Strikethrough & Emphasis

This is deleted text and this is bold and italic and bold italic.


8. Blockquotes

“The only way to do great work is to love what you do.”

— Steve Jobs


9. Nested Lists

  1. First item
    • Sub-item A
    • Sub-item B
      • Sub-sub-item
  2. Second item
  3. Third item

10. GitHub-Style Alerts (Callouts)

Use blockquote syntax with [!TYPE] for styled callouts:

[!NOTE] Useful information that users should know, even when skimming content.

[!TIP] Helpful advice for doing things better or more easily.

[!IMPORTANT] Key information users need to know to achieve their goal.

[!WARNING] Urgent info that needs immediate user attention to avoid problems.

[!CAUTION] Advises about risks or negative outcomes of certain actions.


External links automatically display the website’s favicon:

Check out GitHub for open source projects, YouTube for tutorials, and MDN Web Docs for web documentation.

Other useful sites: Stack Overflow and npm.


12. Multi-Tab Code Snippets

Use the <Tabs> and <TabItem> components to group related code blocks into tabs:

{
"name": "my-app",
"scripts": {
"dev": "astro dev",
"build": "astro build"
}
}
export const config = {
siteName: "My Awesome Blog",
baseUrl: "https://blog.radith.my.id"
};
.container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}

13. Collapsible Sections

Long code blocks can have sections collapsed to focus on what matters:

utils.js
5 collapsed lines
// These imports are collapsed by default
import { something } from 'somewhere';
import { another } from 'another-place';
import { yetAnother } from 'yet-another';
const CONFIG = { debug: true };
// This is the main function you care about
function doSomething(input) {
return input.toUpperCase();
}
4 collapsed lines
// Helper functions collapsed below
function helper1() { return 1; }
function helper2() { return 2; }
function helper3() { return 3; }

14. CSS Color Chips

Color values in CSS automatically get a preview chip:

colors.css
:root {
--primary: #ff6b6b;
--secondary: rgb(78, 205, 196);
--accent: hsl(45, 100%, 60%);
--dark: #2d3436;
--light: rgba(255, 255, 255, 0.9);
}
.button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: 2px solid #333;
}

15. Line Numbers

Enable line numbers with showLineNumbers:

fibonacci.py
def fibonacci(n):
"""Generate the first n Fibonacci numbers."""
if n <= 0:
return []
elif n == 1:
return [0]
fib = [0, 1]
while len(fib) < n:
fib.append(fib[-1] + fib[-2])
return fib
# Generate first 10 Fibonacci numbers
result = fibonacci(10)
print(result)

You can also start from a specific line number with startLineNumber:

continued.js
// This continues from line 42
const answer = 42;
console.log(`The answer is ${answer}`);

16. Fullscreen Mode

All code blocks have a fullscreen button (appears on hover). Click it to view the code in fullscreen mode!

large-example.ts
interface User {
id: number;
name: string;
email: string;
createdAt: Date;
}
class UserService {
private users: User[] = [];
addUser(user: User): void {
this.users.push(user);
}
findUser(id: number): User | undefined {
return this.users.find(u => u.id === id);
}
getAllUsers(): User[] {
return [...this.users];
}
}

17. Typewriter Animation

Terminal blocks can have a typewriter effect (animation plays when visible):

Terminal
$ npm create astro@latest my-new-project
$ cd my-new-project
$ npm install
$ npm run dev

That’s all the features! 🎉

Footnotes

  1. This is the first footnote.

  2. This is the second footnote with more details.

0 Comments

Loading comments...