mimulus

Mimulus is a lightweight XHTML editor implemented as a Firefox extension.

Download: mimulus.xpi (v. 1.0-r332)

It turns any tab into a WYSIWYG editor, enabling a cursor and letting you change existing content just by typing in the browser window, or add new elements such as headings and lists using simple key combinations. It saves to your hard drive, has an option to let you edit the source, and is as minimally invasive as possible. It's great for taking quick HTML notes.

Get Started

Once you've installed the extension by downloading it and restarting Firefox, you'll notice a grey m icon to the right of the status bar at the bottom of the browser. To turn Mimulus on you can either click the icon or press Ctrl+I, both of which turn the icon green to indicate that Mimulus is now active.

To start editing, click somewhere in this paragraph and just start typing. Notice that you now have a cursor, formally known as a caret, enabled so the arrow keys move the cursor around rather than scrolling the window. You can edit most content, and paste content in using Ctrl+V (even on OS X, where Command+V doesn't work).

To save the document, press Ctrl+S. If you're not editing a local document, when you turn Mimulus on it asks you where you want to save your edits to. The status bar reports successful saves, and shows the length of the saved document in bytes.

Emphatic Phrasing

If you press Ctrl+E whilst editing, your text will become emphasized like this. The status bar will tell you which element you're currently in, so after you press Ctrl+E it should say "Mimulus is on. Editing <em>." Press Return to exit the emphasis.

You can also use Ctrl+R for strong emphasis, and Ctrl+L to create links. When you create a link, a Javascript prompt box will appear asking for the URI, the web address, to use for the link. Again, pressing Return will exit these inline elements. If you want to convert existing text to one of these elements, select the text you want to convert and press the appropriate key combination.

To remove inline formatting, make sure the cursor is inside the thing you want to remove phrasing from, and press Ctrl+Y. For example, that'll turn "this" into "this".

Rich Content

To create a new paragraph, if you're in a heading or a paragraph already just go to the end of it and press Return. Or you can press Ctrl+N to do the same thing, and this should work in any other element, including preformatted sections and list items.

Note that if you press Return in the middle of a paragraph, it splits the paragraph up into two new paragraphs. Press Backspace to rejoin them if you did this by accident.

Whenever you create a new paragraph or other block level element, the document will autosave and this will be reflected in the status bar. To create a new <pre> element, use Ctrl+P at the end of an element; to create a new <ul> element, use Ctrl+U at the end of an element; and to create a new heading, use either Ctrl+1, Ctrl+2, or Ctrl+3 depending on the level of heading you want to create.

The only exception to the "you must be at the end of the current element to create a new one after it" rule is inside a preformatted section, where you can create new elements at any time. This is because preformatted sections are rather buggy to edit due to a caret browsing bug in Firefox. This bug also makes editing preformatted sections very difficult if you want to add a new line, so for anything but trivial edits, you can press Ctrl+K inside a <pre> element to convert it into a <textarea> which is then much easier to edit. Press Ctrl+K again to turn it back into a <pre>. This element source editing mode also works with <p> and <ul>.

When you press Ctrl+U to make a new unordered list, you should be able to manipulate list items as follows:

Return in a list item creates a new list item below it.

Backspace in an empty list item removes that list item.

Backspace in the last empty list item removes the whole unordered list.

Don't forget, Ctrl+N lets you create a new paragraph after the list. One other little trick is that Ctrl+J lets you convert paragraphs into preformatted blocks and vice versa; this functionality may change or vanish.

Other Stuff

To edit document source, press Ctrl+H. This will change the tab into a window with two textareas, one for the <head> of the current document and one for the <body>. Pressing Ctrl+S will save, and Ctrl+H will exit source edit mode; no other key combinations work.

When Mimulus is on in a tab, navigating away from it by refreshing the page, clicking a link, moving forwards or backwards through the history etc. will come up with a prompt asking if you really want to do that. This is to make sure that you don't lose work via accidental navigation, which sometimes happens when, for example, deleting a list for some unknown reason.

If you keep getting bugged by the confirmation messages, make sure that you always turn Mimulus off, by pressing Ctrl+I or clicking the green m logo, when you're finished editing! Note that Mimulus is active per tab, not as a browser-wide state. So if it's activated in tab 1 and you switch to tab 2, where it's not activated, it'll still be "running in the background". When you switch back to tab 1, you won't have to reactivate it, it'll be on already automatically.

Sometimes you'll get ghost cursors being displayed around the window. To get rid of these, save the document, exit Mimulus with Ctrl+I, refresh it using F5 or Command+R etc., and then turn Mimulus back on with Ctrl+I again.

Bugs!

Persistent Bugs

As mentioned, preformatted sections do not stand up well to multiline edits. This appears to be a problem with Firefox's caret browsing mode, and not something that is fixable by any direct workaround in Mimulus, other than the <textarea> hack that can be invoked with Ctrl+K.

The source that Mimulus generates isn't particularly pretty, though it does attempt to do some formatting when you switch into source edit mode with Ctrl+H. Using an external script to prettify your HTML if it's important to you may be an option; this isn't something which is likely to be solved in Mimulus itself. Note that Javascript generated content will be saved in all output, which is a bug that mightn't be fixable.

Pending Bugs

I hope to fix all of the following bugs that are currently in Mimulus. If one of these is affecting you more than the others, please let me know so that I can reprioritise it accordingly.

B1: When typing at the bottom of a document, if the cursor goes off of the bottom, Firefox doesn't scroll to follow it. This is strange because if you use the arrow keys to move the cursor off of the bottom, Firefox does follow it.

B2: Unicode doesn't work correctly yet, even when the encoding is set in Firefox to utf-8. Mimulus is almost Unicode friendly, so pasting Unicode characters or entering them via normal keyboard methods looks as though it works but actually saves in the wrong encoding. Editing the source and adding entities doesn't get around this because they're converted to bytes on save.

B3: Sometimes copy gets disabled in Mimulus, and continues when it's off.

B4: Accesskeys interfere with the operation of Mimulus.

B5: Deleting a paragraph doesn't make the focus go to the end of the previous paragraph if the last element inside it is an inline element.

B6: Insert when editing inside a paragraph or block too.

B7: Empty head elements get turned back to HTML from XHTML when source edited.

B8: The caret often disappears. This is probably a Firefox bug, but on the other hand switching to Source Edit Mode and back again seems like a possible fix.

B9: DOCTYPEs aren't preserved. Pretty serious bug.

B10: Return in selected text doesn't break a paragraph.

Note that using the source edit mode (invoke it with Ctrl+H) can often solve these bugs in the interim.

Feature Requests

R1: Support namespace prefixes (Requested by Kevin Reid).

R2: Support the editing of plain text files (Requested by John Cowan).

R3: Autogeneration of tables of content.

Summary

Mimulus is a lightweight editor, and as such it's mainly there to help you to edit existing simple documents in simple ways. More extensive editing can be done using one of the source edit modes, or by using your favourite text editor. Mimulus is also unable to create documents, so you may want to write a little shell script to generate templates.

Since Mimulus preserves any extra information like stylesheets and images, it can be great for making quick edits to even complex existing pages, but it was primarily written to enable taking notes quicker than one can do in, for example, nxml-mode in emacs, awesome though nxml-mode is.

And yes, this documentation was written in Mimulus!

Quick Reference

Editor functions:

Ctrl+I = Turn Mimulus on/off

Ctrl+S = Save

Ctrl+V = Paste

Ctrl+H = Edit source mode

Block level functions:

Return = New paragraph (at end of p, h1, h2, and h3), or new list item (at end of li)

Ctrl+N = New paragraph (in pre, and at end of li, p, h1, h2, and h3)

Ctrl+U = New unordered list (in pre, and at end of p, h1, h2, and h3)

Ctrl+P = New preformatted section (at end of li, p, h1, h2, and h3)

Ctrl+K = Convert <p>, <pre>, and <ul> to <textarea> or vice versa

Ctrl+J = Convert <pre> to <p> or vice versa

Inline level functions:

Ctrl+E = Emphasis

Ctrl+R = Strong emphasis

Ctrl+L = Link

Return = End formatting (in em, strong, and a)

Ctrl+Y = Remove emphasis, strong emphasis, or link formatting (but retain content)

Acknowledgements & About

Mimulus is the fruit of an abandoned through-the-web-editor project started in 2003 by Sean B. Palmer. I originally envisioned it as a single Javascript file that could be used to POST or PUT documents to the web, but I ran into numerous problems with the implementation. In August 2006, I decided to pick the project up again, and once again made a single Javascript file version that had to be included into various pages. This suffered from the main problem that you had to manually give security priviliges to each page that was using the script. I released it to friends late one night, and went to bed.

The next morning, I found that Christopher Schmidt had turned it into a Firefox extension for me! He really liked the concept but wanted a bit more, so he had hacked a couple of bits into the script too. I asked if he could set up an subversion repository for us to work on it together, and we did a lot of editing using SubEthaEdit together on that svn repository. Since he's been in the middle of moving house recently, I've been doing most of the work to the extension, but if it wasn't for him then Mimulus would still be a silly little tatty bit of Javascript.

Of course, projects need identities and styles. Whenever I want a style for something, I say to Cody Woodard "hey, I just made such-and-such, could you make some kind of logo for it?", and he consistently delivers pure awesome. Chris had made a pretty good logo for it already, but it did look a bit too much like the logo of a certain fast food chain for comfort, so thanks to Cody we now have a very elegant and cool looking logo and icon.

Mimulus is now mirrored on Firefox Add-Ons, though the version linked to on this page will always be as new or newer than the version there. You can, however, provide feedback comments and ratings on the Add-Ons site.

Some bits of code were derived from the Bitflux Editor and TiddlyWiki, both of which are licensed under BSD style Open Source licenses. To give back to the community in the same way that Bitflux and TiddlyWiki have made Mimulus possible, Mimulus is also licensed under a BSD style license.

Colophon

The mimulus from which this project gets its name is a yellow flower of the Phrymaceae family, whose name was coined by the great taxonomer Linnaeus. For interested programmers, all the magic happens in mimulus.js.