FEATURE: allow better fidelity for auto linkify, disable most tlds based linkify

New site settings:

enable_markdown_linkify: which is default on, auto links https:// and http:// and mail://

markdown_linkify_tlds: which allows control of what tlds get autolinked for cases such as www.site.com, default is com|net|gov
This commit is contained in:
Sam
2018-02-01 13:22:38 +11:00
parent f2e7b74d88
commit ee0d3f15c1
6 changed files with 54 additions and 3 deletions

View File

@@ -27,7 +27,8 @@ describe "CommonMark" do
html.gsub!('<hr />', '<hr>')
html.gsub!(/<img([^>]+) \/>/, "<img\\1>")
cooked = PrettyText.markdown(md, sanitize: false, linkify: false)
SiteSetting.enable_markdown_linkify = false
cooked = PrettyText.markdown(md, sanitize: false)
cooked.strip!
cooked.gsub!(" class=\"lang-auto\"", '')
cooked.gsub!(/<span class="hashtag">(.*)<\/span>/, "\\1")