---
title: "OPML to Markdown and back"
author: "rsdoiel@gmail.com (R. S. Doiel)"
date: "2016-05-28"
keywords: [ "golang", "opml", "markdown" ]
copyright: "copyright (c) 2016, R. S. Doiel"
license: "https://creativecommons.org/licenses/by-sa/4.0/"
---
OPML to Markdown and back
=========================
By R. S. Doiel 2016-05-28
## Overview
I wrote a Go language package to sort [OPML](http://dev.opml.org/spec2.html) outlines.
I wrote this because my preferred [feed reader ](http://goread.io) supports manual
sorting but not automatic alpha sorting by the _outline_ element's _text_ attribute.
## Observations
Out of the box the OPML 2 Spec provides attributes indicating inclusion of other OPML files,
scripts, basic metadata (create, modified, authorship), and even directory structures.
[Fargo](http://fargo.io) allows user defined attributes to be applied to the _outline_
element in OPML. This could be used in support some of the
[Scrivener](https://www.literatureandlatte.com/scrivener.php)
features I miss such as describing how to render a project to various formats such as
rtf, pdf, ePub, web pages or even [Final Draft fdx](https://www.finaldraft.com/) files.
I write allot of Markdown formatted text. Markdown is simple to index,
search and convert into useful formats. Markdown is not good at expressing more
complex structures such as metadata. Website generators that use markdown often
require a preamble or _front matter_ in the markdown to provide any metadata. This
leaves your document head cluttered and less human readable.
Another approach is to include a parallel document with the metadata. It occurred to me
that an OPML file could easily hold that metadata. It can even hold Markdown content.
The trouble with OPML is that it is not quick to edit by hand.
Is there a round trip semantic mapping between OPML and Markdown?
## Germination of an idea
Entering a web link in Fargo the link is URL encoded and saved in the _text_ attribute of the
_outline_ element.
The source view of a web links in Fargo's _outline_ element looks like
```OPML