JoostKiens / short-code-shortcodes

WordPress plugin for shortcodes rendering <code> and <pre><code> with content converted to htmlentities & disabling wptexturize.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

short-code-shortcodes

WordPress plugin for shortcodes rendering <code> and <pre><code> with content converted to htmlentities & disabling wptexturize.

Description

This WordPress plugin adds two shortcodes for rendering code:

  • [code] for inline code
  • [precode] for blocklevel code

These shortcodes solve 2 problems:

  • Ocassional auto transformation to smart quotes. WP should not convert quotes to smart quotes between <pre> & <code>, but sometimes it happens anyway. These shortcodes explicitly disallow the use of wptexturize.
  • The need to manually convert html tags, etc to htmlentities. The shortcodes convert the content to htmlentities (no quotes, utf-8)

Usage

[code]<p>This is the "code" shortcode, for in-line code. Use it in the same way as you'd use <code>.</p>[/code]

[precode]
<p>
    This is the "precode" shortcode, for block-level code.
    Use it in the same way as you'd use <pre><code>.
<p>
[/precode]

Shortcode attributes

There are no functional attributes.

Core HTML attributes are allowed and get rendered in the resulting html. Example: [code class="code-html" lang="fr-FR"]<h1>Le monde est a nous</h1>[/code]

Installation

  1. Upload short-code-shortcode folder to wp-content/plugins/
  2. Activate plugin through the 'Plugins' menu in WordPress

Change log

0.2.1

  • Fixed formatting error is README.md

0.2.1

  • Added [code] and [precode] buttons to TinyMCE's kitchensink & Quick tags

0.1.1

  • Added trim function to the clean_code_content method

0.1.0

  • Initial commit

About

WordPress plugin for shortcodes rendering <code> and <pre><code> with content converted to htmlentities & disabling wptexturize.


Languages

Language:PHP 80.4%Language:JavaScript 19.6%