Giter Club home page Giter Club logo

mdx_linkify's People

Contributors

brezniczky avatar dagrevis avatar fireforge avatar fokkezb avatar hongquan avatar last-partizan avatar margotkriete avatar radude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mdx_linkify's Issues

Using the extension prevents markdown from outputting XHTML format tags

When using markdown I sometimes specify the output_format as "xhtml". But, if I use LinkifyExtension then this is ignored and any tags that would be XHTML-style are HTML5 style.

For example, the \n\n----\n\n in text here should come out as <hr />, but it doesn't in the second case:

from markdown import markdown
from mdx_linkify.mdx_linkify import LinkifyExtension

text = "Hello\n\n----\n\nBye"

markdown(text=text, extensions=[], output_format="xhtml")

markdown(text=text, extensions=[LinkifyExtension()], output_format="xhtml")

Output:

'<p>Hello</p>\n<hr />\n<p>Bye</p>'
'<p>Hello</p>\n<hr>\n<p>Bye</p>'

I guess this is to do with Bleach?

Some TLDs are not supported

Some of the new TLDs are not supported, and bleach doesn't plan to fix it.

mozilla/bleach#519

Can you add ability to override tlds/url_re to this project? If it's considered good idea, i can make pull-request.

IndexError: pop from empty list

After update to 2.0 i encountered a strange bug, sometimes, very rarely, linkify fails with following traceback:

...
  File "markdown/core.py", line 292, in convert
    output = pp.run(output)
  File "mdx_linkify/mdx_linkify.py", line 34, in run
    return self._linker.linkify(text)
  File "bleach/linkifier.py", line 170, in linkify
    dom = self.parser.parseFragment(text)
  File "bleach/_vendor/html5lib/html5parser.py", line 317, in parseFragment
    self._parse(stream, True, *args, **kwargs)
  File "bleach/html5lib_shim.py", line 399, in _parse
    self.mainLoop()
  File "bleach/_vendor/html5lib/html5parser.py", line 243, in mainLoop
    new_token = phase.processEndTag(new_token)
  File "bleach/_vendor/html5lib/html5parser.py", line 485, in processEndTag
    return self.endTagHandler[token["name"]](token)
  File "bleach/_vendor/html5lib/html5parser.py", line 1372, in endTagP
    node = self.tree.openElements.pop()

And i cannot reproduce it in test case.

But i presume, that's becouse HTMLParser.parseFragment function is not pure.

Before 2.0 bleach.linkify created new Linker instance for each call, here we creating single instance and reusing it.

I moved Linker from __init__ to run in my private project, i'll test it for few days, if it works, i'll create PR with fix.

Unix filenames linkified

First of all, many thanks for providing a maintained package!

I've come by an apparently less frequently experienced behaviour that may not be intentional, the partial linkification of Posix paths. (It may not be an issue.) A (real life :) ) example:

from markdown import markdown

markdown("tests/test_markdown.py", extensions=["mdx_linkify"])

gives

'<p>tests/<a href="http://test_markdown.py" rel="nofollow">test_markdown.py</a></p>'

Albeit .py is a valid TLD, I suspect this may not be as intended, at the very least due to the conversion being partial - I guess it should cover the "tests/" thing then as well ... is there a dedicated workaround and/or a setting that I missed?

I personally wouldn't like this linkified without a protocol part, or at least a "www." at the front - I'll look into accomplishing this via the "Ignoring TLDs" example. I am partial to imagining this to be a more common default preference (I can be biased of course! for now it is just a guess).

(I would also suggest/bring up the ability of configuring https versus the now-less-desirable http protocol, maybe even making it the default. Let's spread good security practice?)

I'll try to give it a look over the weekend, but if it's like something quite trivial (so far as priorities allow ... almost never the case :) even if I'm otherwise quite interested), please do feel free to let me know

  • what I should have noticed, or
  • beat me to investigating the issue, if any

Thanks in advance!

Error with Markdown 2.5.1

I get this error when using mdx_linkify 0.5 with Markdown 2.5.1.

Exception Type: TypeError
Exception Value:
'NoneType' object is not iterable
Exception Location: /home/nnyby/src/dmt/ve/local/lib/python2.7/site-packages/markdown/extensions/init.py in setConfigs, line 75
Python Executable: /home/nnyby/src/dmt/ve/bin/python
Python Version: 2.7.8
Server time: Fri, 7 Nov 2014 13:59:44 -0500

Here's how I'm calling mdx_linkify:

{{object.description|markdown:"linkify"}}

Deprecation warnings after upgrading to markdown 3.0

Hi, thanks for the work on this package!

Minor issue, but after upgrading the markdown package to version 3.0, I'm seeing deprecation warnings for the md_globals parameter, as well as the add call:

Using the add method to register a processor or pattern is deprecated.
'Use the `register` method instead.', DeprecationWarning
/home/circleci/repo/venv/lib/python3.6/site-packages/markdown/core.py:128: 
DeprecationWarning: The 'md_globals' parameter of 
'mdx_linkify.mdx_linkify.LinkifyExtension.extendMarkdown' is deprecated.

Are there plans to upgrade the markdown dependency any time soon? I think the fix should only need to touch the LinkifyExtension class:

def extendMarkdown(self, md, md_globals):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.