This enhancement adds Stack Overflow-style code block styling to your Jekyll blog with the following features:
Each code block now has descriptive emoji headers that make the purpose clear:
_sass/code-styling.scss
- Main styling for code blocksassets/js/code-enhancements.js
- Interactive JavaScript functionalityassets/main.scss
- Added import for new code styling_includes/scripts.html
- Added JavaScript include_posts/2025-01-31-fast-groupwise-calculations-pandas.md
- Enhanced with styled code blocksTo use these enhanced code blocks in your posts, follow this pattern:
**π Sample Data Setup**
```python
import pandas as pd
# Your Python code here
β‘ Optimized Solution
# High-performance code here
## Customization
### Changing Colors
Edit `_sass/code-styling.scss` to modify:
- Background colors
- Border colors
- Language label colors
- Syntax highlighting colors
### Adding New Language Labels
In `assets/js/code-enhancements.js`, add detection patterns:
```javascript
if (code.includes('your_pattern')) {
highlight.classList.add('language-yourtype');
}
Then add CSS in code-styling.scss
:
.highlight.language-yourtype::before {
content: "Your Language";
background: #your-color;
}
Simply change the emoji and text in your markdown:
**π― Your Category Name**
```python
# code here
```
This enhancement makes your technical blog posts more engaging and professional while maintaining excellent readability and usability.