New "reader" macro for sharing JavaScript code

A new macro lets you display the contents of an outline exactly as it would be displayed in Fargo.

<%reader (opmlUrl)%>

Example

Here's an example of the macro being used to display the source code of a Find command I've been working on for the menubar, one that finds the next occurrence of a string in the active outline. You can copy the text from the outline below straight into menubar.opml.

<%reader ("https://dl.dropboxusercontent.com/u/36518280/misc/codeExample.opml")%>

It's very useful for code, but probably could be used for other applications.

How to set it up

1. Copy the outline text you want to share to the clipboard.

2. Create a new outline, choosing New from the File menu.

3. Paste the text into the outline. If there's an extra line, delete it.

4. Chose Get Public Link from the File menu.

5. Copy the URL to the clipboard.

6. Paste it into a call to reader in this post, as shown below.

The exact code

<%reader ("https://dl.dropboxusercontent.com/u/36518280/misc/codeExample.opml")%>

Tip

It remembers how you have the outline expanded, so you can set it up so that it leads the reader to the parts you think they'll find most useful or interesting.

Styles

You can override the style choices I made by including CSS in your <%customStylesScripts%> glossary entry. I separated out the styles from the code so that your styles take precedence.

Inspired by gists

I saw Eric and Jeffrey using GitHub gists to display outline-based code in Fargo. It's a good idea, but gists are really for flat text and are not ideal for structured text. This should work better.


Posted: Tue, 06 Aug 2013 22:23:28 GMT