Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing block in output replaced with md5-stuffstuffstuff #182

Open
mingp opened this issue May 2, 2015 · 3 comments
Open

Missing block in output replaced with md5-stuffstuffstuff #182

mingp opened this issue May 2, 2015 · 3 comments

Comments

@mingp
Copy link

mingp commented May 2, 2015

We have been using the django-markdown-deux markdown Django template tag (and therefore indirectly python-markdown2) occasionally throughout our Django app.

Today, we added a new usage of the markdown Django template tag and saw some unusual behavior in the output rendering. A large block of text/formatting had been removed and replaced with md5-013e64a4a229d1926c2bd523e0c5d77b. Please see attached input and output.

We have found a temporary workaround by including an extra paragraph, containing only  , where the cutoff would otherwise occur.

Possibly related to #127. We're seeing the same symptoms but from different input cases.

Appreciate if you have any insight into this issue. Thanks in advance!

Relevant excerpt of Markdown input: https://www.refheap.com/025bf00f2235b9c7e2601a43a
Relevant excerpt of rendered HTML output: https://www.refheap.com/3eac75d0a0d170170997ed318

@nicholasserra
Copy link
Collaborator

Hello, thanks for the bug report. I'll check it out. Pull requests are also welcome if you think you have a solution for this. Even issuing a PR with some example failing tests would be helpful. Thanks!

@william-index
Copy link

Note on this and note to self:
Line 147 in markdown2.py is currently

return 'md5-' + md5(SECRET_SALT + s.encode("utf-8")).hexdigest()

This is not being unhashed where it needs to be it seems?
I fixed the problem locally for my purposes by replacing with

return s.encode("utf-8")

But I suspect this has other larger repercussions and will introduce more issues along the way.

@ZuluPro
Copy link

ZuluPro commented Nov 9, 2016

I had the same problem with <img>'s src attribute,

All _ was replaced by md5-stuffstuffstuff
My quick fix is the following, I subclass markdown2.Markdown and in postprocess:

for key, value in markdown2.g_escape_table.iteritems():
    text = text.replace(value, key)

markdown2.g_escape_table is g_escape_table = dict([(ch, _hash_text(ch) )for ch in '\\*_{}>#+-.!'])`

So you can unhash the escaped characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants