A WordPress plugin for elegantly managing and displaying code snippets
Adds a custom post type for managing your code snippets with taxonomies for classifying the snippets. Embed snippets with syntax highlighting to posts or pages via a handy shortcode insert button that allows you to pick from the most recent snippets. Syntax highlighting provided by the Prettify javascript library and the Ace Editor.
Features:
- Host your own snippet library.
- Button for easy-copying of snippet (disable with:
add_filter( 'dsgnwrks_snippet_do_click_to_copy', '__return_false' )
). - Button to enable full-screen snippet view (disable with:
add_filter( 'dsgnwrks_snippet_enable_full_screen_view', '__return_false' )
). - Two frontend render engines, prettify (with 2 themes) or Ace (with 32 themes).
- WordPress editor shortcode button for embedding snippets in your content, and creating/editing those snippets on the fly.
- Live (tinymce) previews of the snippets in your content editor.
- Programming language picker (for syntax).
- Snippet tags and categories.
- The front-end script needs to load in the footer so that
wp_localize_script()
works as expected. - Better styling for the full-width view and the buttons in the full-width view
- Better Ace editor support for inline php snippets (i.e. no opening
<?php
tag). - Minify css files.
- Use Ace editor for the snippet add/edit shortcode modal.
- Button for opening modal for easy-copying of snippet.
- Button to enable full-screen snippet view.
- (When using Ace frontend) Button to toggle line-numbers.
- (When using Ace frontend) Button to collapse/minify the snippet.
- (When logged-in) Button to edit Snippet.
- View individual snippet pages, and link to full-screen snippets.
- Live (tinymce) previews of the snippets in your content editor, and edit them in place.
- Option to choose the front-end display theme and render engine (prettify or Ace).
- Ace editor on the snippet-edit page, and option to use the Ace render engine on the front-end. Props JayWood (#22).
- Add new snippets on the fly via the shortcode button (vs having to leave your post and to create them). Props JayWood (#22).
- Add C# as available language.
- BUG FIX: Remove 'html_entity_decode' around snippet output, as it will cause the page display to break under certain circumstances.
- Replace shortcode button's usage of ids with slugs because ids can change during a migration.
- Added filter, 'dsgnwrks_snippet_display'.
- Better handling of WordPress-converted html entities.
- By default, convert tabs to spaces for better readability. Can be disabled with:
remove_filter( 'dsgnwrks_snippet_content', 'dsgnwrks_snippet_content_replace_tabs' );
- Added title attribute to
pre
element to display title of snippet on hover.
- Add more languages
- Add lang parameter to shortcode attributes.
- Use selected snippet language to set the shortcode lang parameter.
- Allow shortcode to specify line number to start with
- WP editor buttons for inserting snippet shortcodes
- First Release