跳到内容

wp-prism

v0.1

mqudsi · 2018年1月14日 上架

wp-prism brings GitHub-styled code-fencing and prism-powered syntax highlighting to your WordPress installation, written from scratch to be as freaky …

正在使用
10 以下
评分
暂无
累计下载
1,387
最近更新
2018年1月15日

贡献者

wp-prism brings GitHub-styled code-fencing and prism-powered syntax highlighting to your WordPress installation, written from scratch to be as freaky fast as possible.

wp-prism currently supports syntax highlighting for 41 languages and only loads the JavaScript and CSS to highlight your syntax when needed.

You can say goodbye to page bloat and long load times, because it makes no sense to do this any other way.

What it does

wp-prism does exactly what it says on the box: it takes a code-fenced block of source code nested in your WordPress pages and posts, like this:

    `rust
fn main() {
    println!("Hello, world!");
}
    `

And turns into a syntax-highlighted work of art, like this:

`rust

fn main() {
println!(“Hello, world!”);
}
<h3>How to install</h3>
Just grab a copy of
wp-prism` from the WordPress plugins repository or clone our github repo from https://github.com/neosmart/wp-prism.

There is no configuration needed.

Avoiding whitespace mangling

WordPress (well, TinyMCE) loves to mangle whitespace in posts. As such, wp-prism supports (and recommends) embedding your code fragments in <pre> tags if you’re going to use the visual editor (or will use the visual editor at any point). wp-prism detects the outer <pre> and takes care not to emit a second <pre> tag in such cases.

To illustrate with an example:

<pre>
    `cpp
void Greet(const char *name)
{
    printf("Hello %s!\n", name);
}
    `
</pre>

`cpp

void Greet(const char *name)
{
printf(“Hello %s!\n”, name);
}
`

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums