Metadata-Version: 1.1
Name: mdx-linkify
Version: 0.6
Summary: Link recognition for Python Markdown
Home-page: https://github.com/daGrevis/mdx_linkify
Author: Raitis (daGrevis) Stengrevics
Author-email: dagrevis@gmail.com
License: MIT
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
        
        If you want the bleeding-edge version (this includes unreleased-to-PyPI code), you can always grab
        the master branch directly from Git.
        
            pip install git+git://github.com/daGrevis/mdx_linkify.git
        
        ## 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:
        
        ## Releasing
        
        _(more like a cheatsheet for me actually)_
        
        * Change version in `setup.py`,
        * Commit and tag it,
        * Push it (including tag),
        * Run `python setup.py register && python setup.py sdist upload`;
        
Keywords: markdown links
Platform: UNKNOWN
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
