Publish Markdown Plugin

In our last tip, we went over how to manually order files and directories within the TKE sidebar. What we didn’t cover is why you would ever want to manually sort files in the sidebar in the first place. One such reason we would do this is to control the order that files are processed within a directory from something like a plugin. The Publish Markdown plugin is one plugin which uses the sidebar ordering of the files to collate Markdown files into a single file and then hand that single file to a Markdown processor for export. This allows you to split your Markdown document into separate files (say, a file per chapter or section) and then organize the files into a particular order to generate a single export document.

After the plugin is installed, it is accessible by right-clicking on a sidebar item. If the item is a directory, all files within the directory and all of its subdirectories will be traversed and organized, in order, into a single temporary Markdown file. After this is complete, the export window will be displayed.

Publish Markdown Export window

If you want to save the file, select “Publish To”, select a directory to save the file to, and click “Publish”.

If you want to export the file as HTML directly, select “Publish To”, select a directory to save the HTML file to, select the “Export As HTML” option, and click “Publish”.

If you want to send the resulting file to an external application, select “Open In”, choose the application from the dropdown list (more on this in a bit), and click “Publish”.

Plugin Options

The Publish Markdown plugin has several options to configure its behavior that are accessible from the Preferences window within the Plugin panel. Select the “publish_markdown” option from the pull-down menu to reveal the options.

Publish Markdown Preferences Panel

You can specify an alternative Markdown processor, select which file extensions will be considered for inclusion, select which file patterns can be used to ignore certain files and setup the external applications that can be accessed by this plugin.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Advertisements
Publish Markdown Plugin

Clipboard Snippet Workflow for Markdown

Instead of talking about a TKE feature this week, let’s look at creating a simple but potentially useful workflow that allows us to copy a URL to the clipboard and essentially paste the text as a well-formatted Markdown link, using a snippet.

To create the snippet, open the TKE Preference window (Command-, on Mac or Control-, on other platforms). Select the Snippets panel and make sure that the Language option menu within the Snippets panel is set to “Markdown”. To add a new snippet, click on the Add button and fill in the resulting snippet editor pane as follows:

After giving the snippet an expansion keyword “clipurl” and entering the snippet code, click the Save button at the bottom of the editing panel to save the snippet. The Preference window will change the snippet panel view to show the list of all saved snippets that are specific to the Markdown syntax. You should see your new “clipurl” snippet in the table which will look like:

So what is going on in this snippet text? Well, when we enter the snippet keyword in a Markdown editing buffer, the snippet will grab the contents stored in the clipboard (a URL in this case), it will remove the URL scheme including the “://“ characters and place the remaining contents between a square bracket pair (this is the displayed link name within a Markdown link). It will then output the full URL between a pair of parenthesis (the link URL within a Markdown link).

So now let’s close the preference window and test out the new clipboard snippet. To do that, navigate to a website within your web browser (we’ll use tke.sourceforge.net for this example) and copy the URL from the address bar. Then back in TKE, create a new editing buffer (Command-n or Control-n), set the syntax of the new editing buffer to Markdown, input our new snippet text “clipurl” in the editing buffer and enter the TAB key to expand our snippet which should look as follows:

Cool! It’s a valid Markdown link with the displayed link name being the copied URL name minus the “http://“ syntax, while the full URL exists in the URL portion of the Markdown link. To test the link out, right click on the underlined link name and the link should be displayed within your web browser.

Now whenever you are working on that next great Markdown document, you can quickly create a Markdown link by simply copying a URL to the clipboard and entering “clipurl”. Try thinking about other ways that you can manipulate the clipboard (or even contents in clipboard history) using snippets to increase your editing productivity.

Consider yourself are a certified TKE power user now. Feel free to impress your friends.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Clipboard Snippet Workflow for Markdown

Text Formatting

When you are editing files with a syntax type that supports text formatting, you can quickly get tired of adding the syntax that is required for doing things like bolding, italicizing, underlining, etc. However, if you are using TKE to do the editing, then your editor has your back.

If you need to italicize some text that you have already typed, simply select the text and use the Edit / Format / Italics (or use the shortcut Command/Control-I). TKE will insert the correct syntax before or around the text. This functionality is super handy and will save a ton of keystrokes, but TKE’s text formatting capabilities don’t stop there.

If you need to bold some text that you are about to type, simply select the Edit / Format / Bold (or using the shortcut Command/Control-B). TKE will insert the proper emboldening syntax and place the cursor at the appropriate spot to start entering the text to be emboldened. Once you have finished entering the formatted text, if there is bold syntax following the text, simply enter the TAB key to move the cursor to the right of that syntax and continue entering text.

Bonus Tip: Any time that you are editing text and you are not filling in a snippet, hitting the TAB key will advance the cursor to the first whitespace character in the current line (unless the cursor is in the first column when the TAB key is entered).

If you need to remove syntax formatting, simply select the text (including the formatting syntax) and then select the Edit / Format / Remove Formatting (or use the Command/Control-minus keyboard shortcut). Any syntax that can be applied via the text formatting feature will be removed from the selected text.

Text formatting support is currently available for the following syntax descriptions:

  • Markdown
  • MultiMarkdown
  • Fountain
  • HTML
  • HelpSystem
  • ManPage
  • Latex

In addition to text formatting options, TKE also supports the following formatting (depending on the availability of the format support in the syntax):

Text Formatting Submenu

Simple, easy, powerful. TKE might just make text formatting fun again.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Text Formatting

URL Validator Plugin

URLs are all around us, sitting in text files which, when rendered, make up the fabric of the world-wide web. For as many good links there are, there are probably just as many URLs to non-existent web pages. If you enter URLs by hand, there are also opportunities for making fat-finger mistakes. Wouldn’t it be great if your text editor had some ability to verify any embedded URLs in its files?

Well, if your text editor is TKE, you do with the help of the URL validator plugin.

After the plugin is installed, going to the Plugins / URL Validator menu will display a few options. You can have the plugin find and validate all embedded URLs in the current file. You can select any URL-styled text and verify that text selection’s validity. You can also bring up an entry field in which you can enter a URL directly and verify it.

Whenever a validation occurs, the plugin will display the results in a separate window, represented in the following image.

URL Validator Result Window

Note that the validated URL is displayed with a good/bad icon, indicating the correctness of the URL. Additionally, the returned status and code are output in the window along with the line number within the editing buffer that contains the URL. You can jump the insertion cursor to the given line number by clicking on the URL entry in the status window.

Super simple. Super handy. What else would you expect?

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

URL Validator Plugin

Markdown Table Beautifier Plugin

In TKE 3.2 a new plugin called the “Markdown Table Beautifier” is included which, when run, cleans up any table syntax found inside of a Markdown document. This essentially involves, making all table columns be vertically aligned and all cell contents be justified according to their column justification indicators. It also will adjust all rows to include the maximum column specified within a table row. All of this cleanup helps make Markdown tables easier to read in Markdown format.

Essentially the Markdown Table Beautifier plugin can run on all tables found within a single Markdown file or it can run only on the table where the insertion cursor is within.

To install the plugin, select the Plugins / Install… menu option, find the Markdown Table Beautifier plugin in the resulting list, highlight it and hit the RETURN key. Once the plugin has been successfully installed, you can run it by simply selecting the Plugins / Markdown Table Beautifier submenu and choosing one of the two available options to beautify all tables or only the currently selected table. Note that these menu options will only be enabled if the file syntax is either Markdown or MultiMarkdown.

Clean and easy to read tables without the fuss? Check and check.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Markdown Table Beautifier Plugin

Markdown Support

Did you know that you can use TKE for writing Markdown files? TKE comes equipped with a Markdown syntax highlighter that goes a bit beyond colors. By default, any files ending with a .md extension will be treated as a Markdown file; however, you can, of course, change the syntax by selecting the “Markdown” item in the lower right corner of the the main window (or via the View / Set Syntax / Markdown menu option).

If you enter Markdown, TKE will display the text as directed by the syntax. So if you enter **bold**, the highlighter will display the word “bold” in bold font.  If you enter one or more pound signs at the beginning of the line, the rest of the line will be displayed in larger text.  And so on and so forth.

In fact, the following Markdown syntax is supported in TKE:

  • “code“ and `code`
  • # Header1, ## Header2, …, ###### Header6
  • **bold** and __bold__
  • *italics* and _italics_
  • […][link] and […](link)
  • […]: link reference
  • ~~overstrike~~
  • ~subscript~
  • ^superscript^
  • ==highlight==

When Markdown syntax is detected and the font is rendered, the Markdown syntax is highlighted in a muted color. When this happens, this syntax is considered to be meta, that is, they are characters that will be written to the file but are not considered to be content. You can hide/show meta characters in an editing buffer, by using the View / Show/Hide Meta Characters option. By hiding meta characters, you can essentially transform the TKE editing buffer into a WYSIWYG Markdown editor. As you type, any characters detected as meta will automatically be hidden, leaving the text in a state of better readability. Of course, all of the Markdown syntax is still a part of the file so saving text with hidden meta characters will still output those characters to the file.

Continue reading “Markdown Support”

Markdown Support