28
Jun

Configuring UltraEdit for Working with Markdown

This article is about how I configured UltraEdit to work with editing of Markdown text files. Many other editors could be configured to work similarly, but the details of setting it up would differ. Behind the scenes, this setup is also using the python programming language. So, the prerequisites for this particular setup are: Use UltraEdit, Markdown, and python.

There are some decent text editors out there that are specifically designed to work with Markdown. I have tried MarkdownPad and StackEdit which runs in your browser. My thinking has been, I already have a good editor so is there are way to integrate markdown into Ultraedit?

Markdown Background

Markdown is a great way to format plain text. To quote Wikipedia:

Markdown is a plain text formatting syntax designed so that it optionally can be converted to HTML using a tool by the same name. Markdown is popularly used to format readme files, for writing messages in online discussion forums or in text editors for the quick creation of rich text documents.

For further details about Markdown, check out WhatIsMarkdown.com. You just have to love Markdown.

UltraEdit Information

UltraEdit is a text editor from IDM Computer Solutions, Inc. that I have been using since it was at version 13. It is currently sitting at version 21. I have a long history with this particular editor and recommend it if you do a lot of serious text editing. It has made tremendous strides forward in functionality in the last two releases that really takes it over the top. UltraEdit is not a free tool, but well worth the $80 price tag.

Syntax Highlighting

UltraEdit uses "wordfiles" to implement syntax highlighting within the editor. I did not find a wordfile for markdown within UE's "Extras" download area. But, searching their forums, there was a forum article about creating a wordfile for markdown. The forum topic contains a preliminary Markdown wordfile that I downloaded and installed.

UE has an article detailing adding a wordfile to the editor that is helpful.

Once the wordfile is installed, editing a file with a filename extension of .md will show the various components of markdown highlighted.

Python Markdown tool

There is a python module for working with Markdown text within python. So, the first thing you will want to do is grab the python markdown tool and install it using the instructions at Installing Python-Markdown.

Become familiar with the command line syntax that can be used with the tool. That is the key to integrating it within UltraEdit or another text editor.

The basic syntax you will use from the command line is:

python -m markdown INPUTFILE -f OUTPUTFILE

INPUTFILE = your markdown text file. OUTPUTFILE = the name of an HTML file.

UltraEdit Advanced Tool Configuration

UltraEdit has a Tool menu where you can add external tools.
Tool configuration dialog

In UltraEdit, on the Advanced menu, select Tool Configuration. Add a new configuration for markdown and set the command line to:

j:\python27\App\python.exe -m markdown "%f" -f "%P%N.html"

In Ultraedit for Linux, the command line is:

/usr/bin/python -m markdown "%f" -f "%P%N.html"

Adjust the path to your installation of python as is appropriate.

So, now whenever you choose Advanced: Markdown from the menu in UltraEdit, it will take the current markdown file in the editor and save it as .HTML in the same folder as your markdown file.

Display the converted file in your browser

Finally, I just added a new tool in the Advance Tool Configuration to launch the browser and load in the newly created .html file.

In linux the tool configuration command line to launch Chromium is:

/usr/bin/chromium-browser "%P%N.html"

It took a little work to get it configured, but I now have a usable system within UltraEdit for working with Markdown files.

Comments

  1. Thanks! This was very helpful. I'm wondering if you know of a way to do the conversion and the launching in Chrome in one step. My guess is that I'd have to create a script in python or PowerShell or something to do that. But since I'm not an advanced UltraEdit user I thought I'd ask.

  2. David Gray says:

    Being something of a shell script fanatic, I extended the supplied script to not only create the HTML document, but to load it into a Web browser, all in one step. My assumption is that if you are creating HTML, you should preview it before you call it done. Hence, I needed to configure just one custom tool.

    My script can also be run interactively to parse a Markdown file and load the resulting HTML file into a Web browser. Prompting is implemented as a set /p command that prompts for the name of a Markdown file, from which it constructs a default name for the HTML file, and feeds both to the Python script.

Leave a Reply

Your email address will not be published. Required fields are marked *

*