Showing posts with label jEdit. Show all posts
Showing posts with label jEdit. Show all posts

20 February 2014

jEdit Markdown plug-in hack

PublishedActual
Birmingham New Street 06:50 06:50
London Euston 08:15 08:15

I have posted in the past about jEdit and Markdown and how I use jEdit to write my Markdown and preview using the Markdown plug-in. There is an annoying bug in the Markdown plug-in from the jEdit plug-in manager (v0.1), that also exists in the latest version on the authors website (0.1.1), which affects nested lists so that when they are generated they only display the first word of the top level list items, this can be replicated and seen as follows:

Firstly create an .md file in jEdit with this content:

1. This is list item 1
    1. This is list item 1.1
    1. This is list item 1.2
1. This is list item 2
1. This is list item 3
    1. This is list item 3.1
        1. This is list item 3.1.1
1. This is list item 4

Next, use the Markdown plug-in in jEdit to preview the text, the following will be shown:

You can see that item 1, 3 and 3.1 only display a single word for their list item.

The original author of the plug-in hosts it in an Atlassian Bitbucket and I could see from the commit history that the dependencies have been updated recently however there was no binary version of the latest project. Using Mercurial I downloaded the project into Eclipse but encountered some issues, these were most likely because my environment isn’t set up correctly for the build but I didn’t have time/inclination to investigate further. As the plug-in is distributed under the GNU GPL I decided to upgrade the plug-in libraries myself by doing the following:

  • Close jEdit
  • Download pegdown-1.4.2.jar, this relies on parboiled
  • Download parboiled-java-1.1.6.jar which relies on parboiled-core-1.1.6.jar and asm-all-4.0.jar
  • Using 7-Zip open the MarkdownPlugin.jar file and edit the MarkdownPlugin.props file within the plug-in so that the following properties change.
    • plugin.ua.pico.jedit.markdown.MarkdownPlugin.jars=parboiled4j-0.9.9.0.jar pegdown-0.8.5.4.jar
      Becomes
      plugin.ua.pico.jedit.markdown.MarkdownPlugin.jars=asm-all-4.0.jar parboiled-java-1.1.6.jar parboiled-core-1.1.6.jar pegdown-1.4.2.jar
  • Copy the modified MarkdownPlugin.jar, parboiled-java-1.1.6.jar, parboiled-core-1.1.6.jar, pegdown-1.4.2.jar and asm-all-4.0.jar to the jars directory of the jEdit install,
  • Start jEdit.

Now when I preview or render a Markdown file I get the lists correctly returned to me:

One of the downsides to this approach is that new features in pegdown that may be supported in the Bitbucket project will not be available.

07 November 2011

MarkDown

PublishedActual
Birmingham New Street 07:10 07:10
London Euston 08:30 08:33

I was speaking to one of my current colleagues the other day about writing documents and about how we approach it. For most cases my instinct has been to write plain text in a text editor, this is simple, clean and means that I can concentrate on the content rather than how it looks. If I wanted to format at the same time then I would mark the text up using HTML but this means that there is a temptation to prettify rather then write. My colleague told me that, like me, he writes plain text and faced similar frustrations until he started using MarkDown.

MarkDown allows a text document to be annotated in a way which, when processed, creates a well formatted and valid HTML document. There are other packages that I have used in the past, like LaTeX and Xilize, that do a similar job to MarkDown but I have found them to be too feature rich. This is a problem as instead of writing my inquisitive mind becomes distracted by trying to use the different features, this is where MarkDown is ideal as it has a small set of mark up. Another benefit of using MarkDown over other systems and HTML is that the actual mark-up syntax is small meaning a MarkDown document is still readable in raw format.

MarkDown Example


MarkDown source...

# Level 1 Heading #
This is some MarkDown with *italic* and **bold** text

## Level 2 heading ##
This section contains some `text that is source code related` and also a [link to the BBC](http://www.bbc.co.uk)

Generated HTML...

<pre><code>
  <h1>Level 1 Heading</h1>
  <p>
    This is some MarkDown with <em>italic</em> and <strong>bold</strong> text
  </p>
  <h2>Level 2 heading</h2>
  <p>
    This section contains some <code>text that is source code related</code> and also a <a href=&quot;http://www.bbc.co.uk&quot;>link to the BBC</a>
  </p>
</code></pre>

How it actually looks...

Level 1 Heading

This is some MarkDown with italic and bold text

Level 2 heading

This section contains some text that is source code related and also a link to the BBC


As you can see, the MarkDown script is cleaner and requires less keystrokes to type. To actually turn MarkDown into an output document you will need to install a transformer program; as previously posted, I use jEdit to write my text documents, this has a handy plug-in that allows the MarkDown text to be previewed in a browser or transformed into HTML for saving.

Another tool I use for MarkDown editing on my ipad is NOCS, this is a text editor that displays the document as rendered MarkDown by default but reverts to raw source for editing, it also integrates with Dropbox so that I can easily pick up my MarkDown documents wherever I am.

The final option for MarkDown processing is to install a tool like MultiMarkDown, this can be used from the command line to generate output in a number of different formats; MultiMarkDown is a superset of MarkDown and introduces extra features.

21 October 2011

jEdit text editor

PublishedActual
Wargrave07:5107:51
London Paddington08:2908:33

Since 2001 I have been using a text editor called jEdit, at the time I was supposed to use Borland JBuilder on my work RedHat machine, however this combination had stability issues so jEdit was the alternative that I found. The large number of plug-ins allowed me to turn jEdit into an IDE which could build using ANT, run Java apps and also debug them. I used this for many years in production environments and for my university dissertation, the subject of which I aimed to turn into a jEdit plug-in

Now that I do a lot of package development (Palantir, Documentum, LiveCycle, fileNet) I have to use Eclipse, this is because most of their dev tools are Eclipse based, sometimes it’s just easier to comply that trying to bend another IDE to fit. I do still have jEdit installed for use as my primary text editor though as there are some features in there that I’ve never found anywhere else and jEdit just makes doing some things quicker. The one plug-in I particularly like is Code2HTML, this will take a buffer and turn its entire contents into formatted and colourised HTML, here is a HelloWorld example:

package examples;

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

The other plug-in I would be lost without is MarkDown, the use of which will be the subject of my next post…