Sample Post with Syntax Highlighting
Table of Contents
1. Introduction
This is a sample post that demonstrates the syntax highlighting capabilities of the Metacritical theme for Alchemist.
2. Code Examples
2.1. Elisp
Here's an example of Elisp code with syntax highlighting:
(defun alchemist-publish (&optional blog-dir theme) "Publish a blog with a specified THEME from BLOG-DIR." (interactive) (let* ((blog-dir (or blog-dir (alchemist--select-blog))) (theme (or theme alchemist-default-theme)) (output-dir (expand-file-name "public" blog-dir))) ;; Export the site (alchemist-export-site blog-dir output-dir theme) ;; Return the output directory output-dir))
2.2. JavaScript
Here's an example of JavaScript code:
document.addEventListener('DOMContentLoaded', function() { // Initialize syntax highlighting const blocks = document.querySelectorAll('pre.src'); blocks.forEach(function(block) { block.classList.add('prettyprint'); // Convert language class Array.from(block.classList).forEach(function(cls) { if (cls.startsWith('src-')) { const lang = cls.substring(4); block.classList.add('lang-' + lang); } }); }); // Initialize prettify prettyPrint(); });
3. Conclusion
The Metacritical theme provides excellent syntax highlighting using Org-mode's native capabilities, making it perfect for technical blogs and code-focused content.
Responses