revolunet/sublimetext-markdown-preview — pull request #199 by facelessuser (2014-06-28 06:28:43+00:00)
Title: Add del, auto links, base64 extensions

I been working on a side project to create a little app to batch process markdown files or take a stream. It is essentially wrapped around Python's Markdown and Pygments, but optionally allows for highlight.js. In the process, I wrote a couple extensions that work directly in Python's Markdown:

I left out other extensions I wrote simply because I don't think there is a demand for them, or like the absolutepath which works directly with the element tree, but you are basically doing this with regex in order to support all the different parsers you are using.

Which brings me to the ones I think people will actually want which is in this pull request:
- **delete** which adds support for strikethrough with \~\~test\~\~ to get this ~~test~~
- **b64** which looks through the element tree to find img tags whose source is local, and converts the image to base64 and embeds it.
- **magiclink** which searches for things like http://somelink/whatever etc. and makes them actual links. Seems to work pretty good

They are isolated in `mpextras` (Markdown Preview extras) so in the future people can add more if desired, and they are enabled like this:

```javascript
"enabled_extensions":
[
"extra",
"toc",
"codehilite",
"mpextras.b64(base_path=${BASE_PATH})",
"mpextras.magiclink",
"mpextras.delete"
],
```

Notice that b64 requires a pramater. This is the base path to convert relative file paths to absolute so it can convert them. I added a little come in MarkdownPreview.py to scan extentions for `${BASE_PATH}` and replace them with the files actual absolute base path or nothing if there is no file name available.

Anyways, let me know what you think. I have not tested this in ST2. I don't currently have ST2 installed, but I figured you might. If not, maybe when I get a chance I can double check this in ST2.