All Projects → daGrevis → Mdx_linkify

daGrevis / Mdx_linkify

Licence: mit
Link recognition for Python Markdown

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Mdx linkify

Parsedown Extra Plugin
Configurable Markdown to HTML converter with Parsedown Extra Plugin.
Stars: ✭ 47 (+161.11%)
Mutual labels:  markdown, extension
Edinote
Note taking web application for self-hosting. Offers tagging & Markdown support; can be used as a simple alternative to Evernote.
Stars: ✭ 17 (-5.56%)
Mutual labels:  markdown
Amwiki
amWiki 是一款由 JS 开发、依赖 Atom 或 Nodejs-Npm 的 Markdown 轻量级前端化开源文库系统
Stars: ✭ 814 (+4422.22%)
Mutual labels:  markdown
Silverstripe Markdowntextareafield
Supercharged textarea with markdown preview for Silverstripe CMS
Stars: ✭ 6 (-66.67%)
Mutual labels:  markdown
Javascript
a chrome extension,game for javascript
Stars: ✭ 5 (-72.22%)
Mutual labels:  extension
React Markings
**Markdown** in <Components/>, <Components/> in **Markdown**
Stars: ✭ 893 (+4861.11%)
Mutual labels:  markdown
Ios Source Probe
🔎 iOS 源码探求系列
Stars: ✭ 807 (+4383.33%)
Mutual labels:  markdown
Active interaction Extras
Useful extensions for active_interaction gem
Stars: ✭ 18 (+0%)
Mutual labels:  extension
Vs Freemarker
FreeMarker language colorization extension for Visual Studio Code
Stars: ✭ 17 (-5.56%)
Mutual labels:  extension
Markdown Wasm
Markdown parser and HTML generator implemented in WebAssembly, based on md4c
Stars: ✭ 833 (+4527.78%)
Mutual labels:  markdown
Group by.ext.ee addon
An ExpressionEngine 2.x extension to add 'group by' support to the channel:entries tag pair.
Stars: ✭ 6 (-66.67%)
Mutual labels:  extension
Readme2tex
Renders TeXy Math for Github Readmes
Stars: ✭ 826 (+4488.89%)
Mutual labels:  markdown
Gata
Bookmarks made better
Stars: ✭ 17 (-5.56%)
Mutual labels:  extension
Docpress
Documentation website generator
Stars: ✭ 815 (+4427.78%)
Mutual labels:  markdown
Crisscross
A Markdown-centric template engine for batch offline document generation.
Stars: ✭ 18 (+0%)
Mutual labels:  markdown
Online Markdown
A online markdown converter specially for Wechat Public formatting.
Stars: ✭ 812 (+4411.11%)
Mutual labels:  markdown
Showdown Htmlescape
Plugin for Showdown to prevent the use of arbitrary HTML and allow only the specific Markdown syntax.
Stars: ✭ 6 (-66.67%)
Mutual labels:  markdown
Cocalc
CoCalc: Collaborative Calculation in the Cloud
Stars: ✭ 888 (+4833.33%)
Mutual labels:  markdown
Phd thesis markdown
Template for writing a PhD thesis in Markdown
Stars: ✭ 898 (+4888.89%)
Mutual labels:  markdown
Blockly Gamepad
A Blockly extension designed to develop games (made with love ❤)
Stars: ✭ 18 (+0%)
Mutual labels:  extension

Mdx Linkify

Travis Coveralls PyPI PyPI

This extension for Python Markdown will convert text that look like links to HTML anchors.

There's an alternative package that serves the same purpose called markdown-urlize. The main difference is that mdx_linkify is utilizing the excellent bleach for searching links in text. 👏

Usage

Minimal Example

from markdown import markdown

markdown("minimal http://example.org/", extensions=["mdx_linkify"])
# Returns '<p>minimal <a href="http://example.org/">http://example.org/</a></p>'

Installation

The project is on PyPI!

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

Configuring Linker

To configure used Linker instance, use linker_options parameter. It will be passed to bleach.linkifier.Linker unchanged.

Example: Parse Emails

from mdx_linkify.mdx_linkify import LinkifyExtension
from markdown import Markdown

md = Markdown(
    extensions=[LinkifyExtension(linker_options={"parse_email": True})],
)

assert md.convert('[email protected]'), '<p><a href="mailto:[email protected]">[email protected]</a></p>'

Example: Custom TLDs

from mdx_linkify.mdx_linkify import LinkifyExtension
from bleach.linkifier import build_url_re
from markdown import Markdown

md = Markdown(
    extensions=[LinkifyExtension(linker_options={"url_re": build_url_re(["custom", "custom2"])})],
)

assert md.convert('linked.custom'), '<p><a href="http://linked.custom">linked.custom</a></p>'

Example: Ignoring TLDs

from mdx_linkify.mdx_linkify import LinkifyExtension
from markdown import Markdown

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

    return attrs

md = Markdown(
    extensions=[LinkifyExtension(linker_options={"callbacks": [dont_linkify_net_tld]})],
)

assert md.convert("not-linked.net"), '<p>not-linked.net</p>'

Development

git clone [email protected]: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! 👍

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;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].