Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
c91d4552
Commit
c91d4552
authored
Jan 19, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly set excludeTrailingPunctuationFromURLs to true in showdown config
parent
67b517fb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
render-markdown.js
src/sidebar/render-markdown.js
+1
-0
render-markdown-test.js
src/sidebar/test/render-markdown-test.js
+10
-0
No files found.
src/sidebar/render-markdown.js
View file @
c91d4552
...
@@ -31,6 +31,7 @@ function renderMarkdown(markdown) {
...
@@ -31,6 +31,7 @@ function renderMarkdown(markdown) {
converter
=
new
showdown
.
Converter
({
converter
=
new
showdown
.
Converter
({
extensions
:
[
targetBlank
],
extensions
:
[
targetBlank
],
simplifiedAutoLink
:
true
,
simplifiedAutoLink
:
true
,
excludeTrailingPunctuationFromURLs
:
true
,
// Since we're using simplifiedAutoLink we also use
// Since we're using simplifiedAutoLink we also use
// literalMidWordUnderscores because otherwise _'s in URLs get
// literalMidWordUnderscores because otherwise _'s in URLs get
// transformed into <em>'s.
// transformed into <em>'s.
...
...
src/sidebar/test/render-markdown-test.js
View file @
c91d4552
...
@@ -45,6 +45,16 @@ describe('render-markdown', () => {
...
@@ -45,6 +45,16 @@ describe('render-markdown', () => {
'https://hypothes.is/stream?q=tag:group_test_needs_card</a></p>'
'https://hypothes.is/stream?q=tag:group_test_needs_card</a></p>'
);
);
});
});
[
'.'
,
','
,
'!'
,
'?'
].
forEach
(
symbol
=>
{
it
(
'should autolink URLs excluding trailing punctuation symbols'
,
()
=>
{
assert
.
equal
(
render
(
`See this link - http://arxiv.org/article
${
symbol
}
`
),
'<p>See this link - <a href="http://arxiv.org/article" target="_blank">'
+
`http://arxiv.org/article</a>
${
symbol
}
</p>`
);
});
});
});
});
describe
(
'markdown rendering'
,
()
=>
{
describe
(
'markdown rendering'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment