Mathematica Toolbox

By : C. E.

Mathematica Toolbox is a set of shortcodes for users who sometimes write about Mathematica programming. It is the only WordPress plugin that supports syntax highlighting for Wolfram Language, the language used in Mathematica.

Syntax highlighting and formatting

  • Uses the same highlighting script that is used on Mathematica.StackExchange.com and on Wolfram Community.
  • Preserves code indentation and prevents WordPress from inserting <br> and <p> into code.
  • Replaces Wolfram Language character codes such as \[Alpha], \[Gamma] etc. with their corresponding characters.

The highlighting feature can be triggered in two ways. In the editor [wlcode]Wolfram Language code here[/wlcode] can be used to place a code block directly into the text, however it is often desirable to put the code elsewhere and refer to it instead of putting it into the text itself. This is achieved by the shortcode [wlcode field="name"] where name refers to a custom post field that holds the code that should be inserted at that point. You may have to go to "screen options" at the top of the editor page to enable custom post fields before you can see the custom post field form.

To write code as a part of a sentence, that is, inline, you can use the shortcode [wlinline]code[/wlinline]. This will wrap the code with the <code> tag and thus (in many themes) distinguish the code visually.

Embed Wolfram technologies

  • Easily embed CDFs on any post or page.
  • Retrieve and display an image from a Wolfram Cloud API.
  • Retrieve and display raw data from a Wolfram Cloud API.
  • Display a link to the documentation of a Wolfram Language function.

The official plugin from Wolfram Research that embeds CDFs does not work since WordPress 4.0.1. The shortcode in this plugin takes exactly the same arguments, so the instructions for that plugin are still valid and migration is painless.

The shortcode is [WolframCDF source="" width="" height="" altimage="" altimagewidth="" altimageheight=""], and the parameters and the alternative image (that is shown to those that don't have the CDF player) can be retrieve from the export wizard in Mathematica. The CDF file and the image can be uploaded to WordPress' media library. source and altimage refer to the URLs of these two files.

The Wolfram Language functions CloudDeploy and APIFunction can be used to deploy so called instant APIs. The url to an instant API includes an ID number that identifies that particular API. [WolframCloudAPI id=""] can be used to display the result of calling the API if it is an image, and [WolframCloudAPI id="" image="false"] if it isn't. Any extra parameters that the API needs can also be passed along There are two working examples for this feature under FAQ.

The shortcode [wldoc]function[/wldoc] generates a link to the online documentation page of function.

Retrieve posts from Mathematica.StackExchange.com

The shortcode [mma_se_questions ids="11350;3345;3646"] retrieves the questions with the given IDs. Note that the IDs are separated by semicolons. Answers can be retrieved similarly by [mma_se_answers ids="25616;259"]. The display format in each case is an unordered list.

Retrieve profile information from Mathematica.StackExchange.com

The shortcode [mma_se_user user_id="731"] displays a link to the Mathematica.StackExchange user profile of user 731. The link text is the user's name. [mma_se_user user_id="731" link="false"] displays the name without turning it into a link.

The shortcode [mma_se_profile_box user_id="731"] displays a box with basic facts about user 731. Please see the screenshots page for a better understanding of what the result is.

The shortcode [mma_se_user_questions user_id="731"] and [mma_se_user_answers user_id="731"] displays lists of questions and answers respectively written by user 731. This shortcode is a direct interface between WordPress and the Stack Exchange API: any parameter in the API can be added to the shortcode. For example [mma_se_user_questions user_id="731" pagesize="5" sort="votes"] returns the five questions asked by user 731 that have the most votes. The full set of parameters is in the documentation for the Stack Exchange API.

Caching of results Note that queries sent to the Stack Exchange API are cached in the background, so for example [mma_se_user user_id="731"] will only look that user up once a week at most, because a week is the default expiration time of the cache. It's good to let the cache expire because sometimes users change their names. All mma_se_ shortcodes accept a parameter called expiration that can be used to specify the expiration time in seconds.

Credits

  • The highlighter script is Google Code Prettify.

  • Patrick Scheibe wrote the Google Code Prettify extension for Mathematica. He also wrote this browser extension with capablities that inspired this plugin, documentation links and Mathematica glyph codes to glyphs conversion.

  • The CDF embedding Javascript script was written by Wolfram Research.

  • The WordPress Plugin Boilerplate was used in this project.

  • The banner at the top of this page was generated with code that's available in the Mathematica documentation under ArrayPlot.

WolframCDF

The Wolfram CDF Plugin adds a CDF button to the WordPress HTML and visual post editors. To use this plugin, open up a post you wish to edit. Click in the editor where you want the CDF content to be displayed and click the CDF button. Placeholder text will appear in the place of your selection. The.........

Similar: 50%

Snippets Done Right

Snippets Done Right allows you to create code snippets in over 100 programming languages and choose between 32 highlighter themes. The front-end and back-end are powered by ACE Editor. It provides syntax highlight in PHP, HTML, CSS, Javascript, Java, Python and many more. You can write your code s.........

Similar: 13%

Code Snippet Library

"Code Snippet Library" is designed for use on code tutorial sites - it gives you a way to store code snippets that you can use numerous times in any post. You simply create the snippet and place the relevant shortcode where you want it to appear. The snippets are managed using WordPress' taxonomy UI.........

Similar: 13%

asm-brush

asm-brush is small WordPress plugin I wrote and dedicated to the dinosaurs (like me) who still use and want to share assembly language source code. It is a brush designed to work with the SyntaxHighlighter Evolved http://wordpress.org/extend/plugins/syntaxhighlighter/ WordPress plugin (written by Vi.........

Similar: 12%

Mivhak Syntax Highlighter

Have you been looking for a syntax highlighter that is safe to use on both the visual and the HTML WordPress editor? What about a tool that highlights your syntax While writing your code, and also checks for syntax errors? Well, look no further. Mivhak is a lightweight syntax highlighter for WordPr.........

Similar: 10%

Dottoro Syntax Highlighter

Dottoro Highlighter plugin is based on the Dottoro Syntax Highlighter service that provides professional coloring for CSS, HTML, JavaScript and XML languages. It supports highlighting CSS, JavaScript and XML blocks embedded into HTML documents, optionally selectable line numbering and buttons for co.........

Similar: 10%

Prism Syntax Highlighter for WordPress

Despite two plugins already on wordpress.org I decided to write my own from scratch. The result is a minimalistic but powerful plugin with only ~250 lines of PHP. Supports every possible Prism configuration. Does not load prism on every page, only when needed. Supports automatic detection of prism.........

Similar: 10%

HTML Editor Syntax Highlighter

Add syntax highlighting to the Post/Page HTML editor....

Similar: 10%

iG:Syntax Hiliter

iG:Syntax Hiliter allows you to post source code to your site with syntax highlighting and formatting (as seen in code editors, IDEs). You can paste the code as is from your code editor or IDE and this plugin will take care of all the code colouring and preserve your formatting. It uses the GeSHi l.........

Similar: 10%

Short Syntax Highlighter Shortcode

Short Syntax Highlighter allows you to easily post syntax-highlighted code to your site without losing it's formatting or making any manual changes. Without adding any JS or css file in your theme. This plugin will help you to highlight the code systax. Step by step installation instructions >&.........

Similar: 8%