Friday, January 10, 2014 at 10:26 AM

"reader" macro for sharing code

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

<%reader (opmlUrl, font, fontSize, lineHeight)%>

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.

How to set it up

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

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

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

  • Chose Get Public Link from the File menu.

  • Copy the URL to the clipboard.

  • 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")%>

Notes

  • 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.

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

  • The last three parameters are optional. If they aren't specified, the values we use are: Arial, 16 and 24.

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.

Last built: Tue, Dec 9, 2014 at 3:29 PM

By Dave Winer, Friday, January 10, 2014 at 10:26 AM. We don't need no stinkin rock stars.