https://github.com/getpagespeed/fast-code-prettify
Wordpress plugin for highlighting source code using Google Prettify
https://github.com/getpagespeed/fast-code-prettify
Last synced: 5 months ago
JSON representation
Wordpress plugin for highlighting source code using Google Prettify
- Host: GitHub
- URL: https://github.com/getpagespeed/fast-code-prettify
- Owner: GetPageSpeed
- Created: 2017-10-06T17:28:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T12:22:29.000Z (about 2 years ago)
- Last Synced: 2024-12-31T18:30:14.494Z (over 1 year ago)
- Language: PHP
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fast Code Prettify
This super small Wordpress plugin ensures Google Prettify syntax for Jetpack Markdown & Fenced Code Blocks.
In a nutshell, it enables syntax highlighting of your Markdown code.
* Updates JetPack's Markdown fenced blocks HTML to unified format:
```html
...
```
From:
```html
...
```
Or:
```html
...
```
* Includes Google Prettify from CDNJS when needed, does so with ```async``` attribute of ```script``` tag.
* Comes with no GUI for settings, very lightweight and does its thing to syntax highlight code!
## Usage notes
* JetPack fenced block Markdown is specified like this:
```css
p.warning { color: red; }
```
* Defaults to ```bash``` when no language specified in fenced block. You can also use 4-spaces separated code blocks instead of backticks to highlight using default language.
* You must include the prettify CSS to your theme's ```style.css```. It is too small to be dynamic. Also Wordpress doesn't have native way to dynamically include CSS without affecting performance.
## Caveats
* I will not make default language as a setting. I don't want to deal with silly Wordpress options mechanism and I don't want to have any database impact. The plugin is simple for efficiency. (Goodbye bloatware plugins)