This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Mdx Linkify

[![Build Status](https://travis-ci.org/daGrevis/mdx_linkify.png?branch=master)](https://travis-ci.org/daGrevis/mdx_linkify)
[![Coverage Status](https://coveralls.io/repos/daGrevis/mdx_linkify/badge.png?branch=master)](https://coveralls.io/r/daGrevis/mdx_linkify?branch=master)
[![PyPI Downloads](https://pypip.in/d/mdx_linkify/badge.png)](https://pypi.python.org/pypi/mdx_linkify)
[![PyPI Version](https://pypip.in/v/mdx_linkify/badge.png)](https://pypi.python.org/pypi/mdx_linkify)

This extension for [Python Markdown](https://github.com/waylan/Python-Markdown)
will convert all links to HTML anchors.

There's [an existing solution](https://github.com/r0wb0t/markdown-urlize) for
parsing links with regexes. Mdx Linkify is a bit smarter and asks
[Bleach](https://github.com/jsocol/bleach) to parse them. :clap:

## Usage

### Basic Example

By default, if you add `linkify` extension to `markdown` extensions...

```python
from markdown import markdown


text = "http://example.org/"

assert markdown(text) == "<p>http://example.org/</p>"

expected = markdown(text, extensions=["linkify"])
actual = '<p><a href="http://example.org/">http://example.org/</a></p>'
assert expected == actual
```

...it will automatically convert all links to HTML anchors.

### Linkify Callbacks

If you need callbacks, you can specify them in `extension_configs` like shown
below.

```python
from mdx_linkify.mdx_linkify import LinkifyExtension
from markdown import Markdown


def dont_linkify_txt_extension(attrs, new=False):
if attrs["_text"].endswith(".txt"):
return None

return attrs

md = Markdown(
extensions=[LinkifyExtension()],
extension_configs={
"linkify": {
"linkify_callbacks": [[dont_linkify_txt_extension], ""]
}
}
)

assert md.convert("not_link.txt"), '<p>not_link.txt</p>'

expected = md.convert("example.com")
actual = '<p><a href="http://example.com">example.com</a></p>'
assert expected == actual
```

...here, we only convert links that do **not** end with `.txt` extension.

## Installation

The project is [on PyPI](https://pypi.python.org/pypi/mdx_linkify)!

pip install mdx_linkify

## Development

```
git clone git@github.com:daGrevis/mdx_linkify.git
virtualenv mdx_linkify/
cd mdx_linkify/
source bin/activate
python setup.py install
python setup.py test
```

Pull requests are much welcome! :+1:
Release History

Release History

0.6

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mdx_linkify-0.6.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source Jan 22, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting