Trunk Notes Early Access Build – minor update

A tiny update to the Trunk Notes for Mac “Early Access Build” is now available. The tiny update refers to it now sorting the page lists so that the most recently changed is at the top. The next non-tiny update will make this configurable and include file watching so that if a page is updated on Dropbox or by another app Trunk Notes will pick that up immediately.

If you are using the previous version it is probably best if you keep it around (and backup your wiki) before trying this – just in case!

Download Trunk Notes for Mac EAB 20120807

Trunk Notes for Mac – Early Access Build

WARNING! WARNING! WARNING! If you don’t want to run potentially buggy, pre-beta, pre-release software on your Mac turn away now!

Trunkicon128

UPDATE: If you tried the 20120729 build and found searching caused a crash try updating to the 20120730 build (link at bottom of page)

I hope the above warning is dramatic enough to deter users who only want a polished, finished version of Trunk Notes for Mac. Lots of distractions such as my day job, girlfriend, Word Frazzle!, Trunk Notes for iOS, … have colluded to me missing many self imposed deadlines for getting Trunk Notes for Mac finished and released. As such I have decided to throw caution to the wind and release what I’m terming an ‘Early Access Build’. There are some (but not many) additional features to implement and already identified bugs to fix before I would call Trunk Notes for Mac 1.0 a beta, however it might be interesting for some users to have a play with a build now – and not wait another month or possibly more.

Some details about this build:

  • It is sandboxed – which is great for keeping everything secure and partitioned away from the rest of your data and apps. By default all your notes are installed in the sandbox environment. If you want to store your wiki somewhere else set a default location from the preferences.
  • It is developer signed. This way you know that this has come from Apps On The Move (Matthew Kennard).
  • I have been using a slightly earlier build for keeping notes for a couple of months and so far haven’t had too many issues.
  • It isn’t advised that you use this with Trunk Notes for iOS. However, if you really want to and are aware of the consequences (i.e. it might mess up your data), you can hook it up to use a wiki you synchronise using Dropbox. Bring up the preferences, select a custom location for the wiki, and choose the folder containing the notes/ and files/ directories. You will need to restart the Mac app to detect changes to the wiki – however Dropbox will be updated fairly quickly as soon as you save a page.
  • The icon is an example of programmer art – I will be shortly commissioning an icon. However I am interested to hear what people think of the concept, rather than the execution, of the current icon.
  • The only functions implemented are {{image}} and {{lua}}.
  • You need to be running Mac OS X 10.7 or above. This build has only been tested on the GM version of Mountain Lion.
  • Although the preferences indicate that you can change the syntax highlighting style and viewing CSS this isn’t operational in this build. It will be once I have some nice defaults created.
  • Search is very basic – and the pages are listed in no particular order in the sidebar. This is the next feature I will be working on.
  • The list continuation still needs a little work before its really nice to use.
  • This build does not expire – however it is also completely unsupported.

Some tips on using Trunk Notes for Mac:

  • Switch quickly between Markdown and HTML mode using the keyboard shortcut SHIFT+CMD+E. HTML mode and Markdown mode will be renamed to something more friendly in a later release.
  • Use the keyboard shortcuts CMD+[ and CMD+] to go quickly back and forwards in the history. This works in both Markdown and HTML modes.
  • CMD+L will take you directly to the search field.
  • CMD+N creates a new page. Type in the page name, press return and start typing. If you are currently focused on the search field then the search text will be used as the basis for the new page name.
  • To import images or PDFs files into the wiki simply drag them to the Trunk Notes icon on the dock.
  • Clicking an image/PDF on the File: page will open that image/PDF in Preview.
  • There are some Markdown specific editing features. For example select some text and press CMD+B to make it bold. The text stays selected so you can press CMD+B a second time to remove the bold.
  • You can tag notes – bring up the inspector to see the list of tags. The tags applied to the current note will be ticked.
  • If you want to open up a page in another editor simply drag the proxy icon to the icon of the other app.

Finally, what you have been waiting for, is the download link:

I look forward to your feedback. Feel free to email your comments to mgkennard@appsonthemove.com or add to the Apps On The Move forum!

Trunk Notes 2.6.2 – minor Lua change

I have just submitted a minor update to Trunk Notes. In addition to a long overdue fix to sound recording (and support for a compressed format for much smaller recordings) there has been a minor update to Lua.

Lua scripting now knows some basic information about the device it is running on. This was prompted by users asking whether they could have different CSS files for the iPad and  iPhone. With this new Lua feature it should be simple to add this with a little bit of scripting.

Here is the excerpt from the manual describing this new feature:

Lua has access to some information about the device Trunk Notes is running on. This can be useful for customizing your wiki depending on whether it is running on your iPhone or iPad.

A device table in the global environment has the following fields:

  • name – e.g. Matt’s iPad
  • systemName – e.g. iPhone OS
  • systemVersion – e.g. 5.1.1
  • model – e.g. iPad
  • localizedModel – if your locale defines a different name for the device.

For example:

if device.model == "iPad" then
return "This is an iPad!"
else
return "This is not an iPad"
end

Trunk Notes scripting

Trunk Notes 2.6.0 is nearly ready for some final testing and release. It is quite a bit speedier than previous versions of Trunk Notes (especially for those with large wikis) and now has it’s own scripting language.

Adding scripting to Trunk Notes makes it even more powerful. Users can now do things in Trunk Notes that could previously only be done in desktop editors. Whilst this is only a starting point there are still lots of things to play with.

The scripting language built into Trunk Notes is Lua, a language ideal for embedding into applications. It is a very small, fast and powerful language which is easy to use and has lots of exciting features. Check out the Lua website for more information.

To whet your appetite here are a couple of examples of Lua scripts in Trunk Notes.

Day/Night example

There are a number of users who have experimented with JavaScript solutions to have Trunk Notes automatically switch between two stylesheets depending on the time of day.

Using the new Lua scripting it becomes possible to do this much more easily – and elegantly.

In my Header page, which gets included in every document, I add a call to a Lua script which will include the relevant stylesheet:

{{lua DayNight.lua}}

This will run the commands contained in the page DayNight.lua and insert the result into the current page.

Here is my DayNight.lua page:

hour = tonumber(os.date('%H'))
if hour < 7 or hour > 20 then
    return "{{stylesheet Night.css}}"
else
    return "{{stylesheet Day.css}}"
end

As you can see anything returned from Lua is treated as Markdown and included at the point where the script was called.

Manipulating the wiki

What you couldn’t do in JavaScript, even if you tried really really hard, was create new wiki entries. This is now almost trivial. An example:

-- Create a new wiki page (if this page already exists the new_page will be nil)
new_page = wiki.new('MyNewPage')
-- Put the date in the contents of the page
new_page.contents = os.date()
-- Tag this as Journal and Lua (tags are created if necessary)
new_page.tags = {'Journal', 'Lua'}
-- Save the page
wiki.save(new_page)
-- Return the page name
return new_page.title

There are also Lua functions for searching the wiki, getting lists of tags and retrieving existing pages. Arguments can be passed to scripts, e.g. {{lua ExampleScript.lua, argument 1, argument 2}} and retrieved through the args array.

Scratching the surface

I’m looking forward to see what new and innovative uses the Trunk Notes community makes of Lua scripting. Trunk Notes 2.6.0 is going through some final testing now before it is submitted to Apple next week (probably).

Keep having fun with Trunk Notes – stay productive!

(Lua scripting will play a big part in making Trunk Notes for Mac a powerful wiki to have on your desktop. Watch this space!)

Trunk Notes 2.5.7

Christmas is approaching and so is a new release of Trunk Notes. It is currently in the Apple approval queue along with countless apps for the holiday season – which is why it’s not quite on the App Store yet.

There are four main changes in this release. Two new functions and some custom stylesheet enhancements.

The new functions are prefix and search. These allow you to search for and display lists of matching pages.

Lets say you want a list on your HomePage of all pages whose title starts with Meeting. Simply add {{prefix Meeting}}. If you use namespaces to separate parts of your wiki this can be used to create mini contents pages for each section.

The second new function is search. As you might guess this produces a list of notes by searching the notes for a specific word or phrase. For example {{search Trunk Notes}} will give you a list of all pages containing the phrase “Trunk Notes”.

The other two changes are both related to CSS. CSS is how web pages (and pages in your Trunk Notes wiki) determine what styling (fonts, colours, etc) to use.

The first change is how the {{stylesheet}} function works. In previous versions of Trunk Notes if you wanted to specify a stylesheet for use on a particular page, e.g. {{stylesheet HomePageStylesheet}} then that stylesheet had to include all of the stylesheet information needed to display the page sensibly. This was true even if all you wanted to do was change the font to be slightly larger. In 2.5.7 {{stylesheet}} adds the styles on top of the main stylesheet.

For example if I wanted on my HomePage to make the font smaller so that more information could fit I could create a new page called HomePageStylesheet and in that add the text:

body {
    font-size: 14px;
}

Then add {{stylesheet HomePageStylesheet}} somewhere in HomePage. This makes it much easier to create styles to be used only on specific pages.

Related to this change is the ability to define styles which get applied to pages with certain tags. If you have a page with the tag “Large Font” you can now use a CSS class .tag-largefont to define how you want the content to look. For example:

body.tag-largefont {
    font-size: 18px;
}

Hopefully Trunk Notes 2.5.7 will be in the App Store any day now – as soon as Apple have reviewed all of the Christmas Cracker apps sitting ahead of it in the queue!