Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make markdown less aggressive #492

Merged
merged 6 commits into from
Sep 23, 2016
Merged

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Sep 22, 2016

  • Use some more advanced (public) interface of marked to improve our detection of when a message contains markdown and what markdown gets rendered.
  • Disable marked's linkification of plain links which isn't very good.
  • Stop any message with quotes or other characters normally escaped in html from being sent as HTML messages when they otherwise would not be.

Fixes element-hq/element-web#1512

Preserves the old behaviour of not wrapping everything in p tags,
but also returns valid markup if the resulting markdown contains
multiple paragraphs (previously it stripped the <p> from the start
and the </p> from the end, leaving closing and opening paragraph tags
in the middle of the returned markup).

Also turn on the 'xhtml' option so marked uses self-closing tags
for br's, hr's and so forth.
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm except typoes


// replace the default link renderer function
// to prevent marked from turning plain URLs
// into links, because tits algorithm is fairly
Copy link
Member

@richvdh richvdh Sep 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tits!

}

_copyTokens() {
// copy tokens (the parser modifies it's input arg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/it's/its/

@richvdh richvdh assigned dbkr and unassigned richvdh Sep 23, 2016
@dbkr dbkr merged commit d0a1597 into develop Sep 23, 2016
dbkr added a commit that referenced this pull request Sep 23, 2016
Equivalent of #492 for rich text mode
@richvdh richvdh deleted the dbkr/make_markdown_less_aggressive branch February 15, 2017 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants