mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
markdown: Fix marked generation of unnecessarily absolute URLs.
The new versions should exactly match the HTML we generate in the backend unit test suite.
This commit is contained in:
@@ -299,15 +299,15 @@ run_test('marked', () => {
|
||||
{input: 'These #* #*** are also not mentions',
|
||||
expected: '<p>These #* #*** are also not mentions</p>'},
|
||||
{input: 'This is a #**Denmark** stream link',
|
||||
expected: '<p>This is a <a class="stream" data-stream-id="1" href="http://zulip.zulipdev.com/#narrow/stream/1-Denmark">#Denmark</a> stream link</p>'},
|
||||
expected: '<p>This is a <a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a> stream link</p>'},
|
||||
{input: 'This is #**Denmark** and #**social** stream links',
|
||||
expected: '<p>This is <a class="stream" data-stream-id="1" href="http://zulip.zulipdev.com/#narrow/stream/1-Denmark">#Denmark</a> and <a class="stream" data-stream-id="2" href="http://zulip.zulipdev.com/#narrow/stream/2-social">#social</a> stream links</p>'},
|
||||
expected: '<p>This is <a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a> and <a class="stream" data-stream-id="2" href="/#narrow/stream/2-social">#social</a> stream links</p>'},
|
||||
{input: 'And this is a #**wrong** stream link',
|
||||
expected: '<p>And this is a #**wrong** stream link</p>'},
|
||||
{input: 'This is a #**Denmark>some topic** stream_topic link',
|
||||
expected: '<p>This is a <a class="stream-topic" data-stream-id="1" href="http://zulip.zulipdev.com/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> stream_topic link</p>'},
|
||||
expected: '<p>This is a <a class="stream-topic" data-stream-id="1" href="/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> stream_topic link</p>'},
|
||||
{input: 'This has two links: #**Denmark>some topic** and #**social>other topic**.',
|
||||
expected: '<p>This has two links: <a class="stream-topic" data-stream-id="1" href="http://zulip.zulipdev.com/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> and <a class="stream-topic" data-stream-id="2" href="http://zulip.zulipdev.com/#narrow/stream/2-social/topic/other.20topic">#social > other topic</a>.</p>'},
|
||||
expected: '<p>This has two links: <a class="stream-topic" data-stream-id="1" href="/#narrow/stream/1-Denmark/topic/some.20topic">#Denmark > some topic</a> and <a class="stream-topic" data-stream-id="2" href="/#narrow/stream/2-social/topic/other.20topic">#social > other topic</a>.</p>'},
|
||||
{input: 'This is not a #**Denmark>** stream_topic link',
|
||||
expected: '<p>This is not a #**Denmark>** stream_topic link</p>'},
|
||||
{input: 'mmm...:burrito:s',
|
||||
@@ -340,7 +340,7 @@ run_test('marked', () => {
|
||||
{input: 'Test *italic*',
|
||||
expected: '<p>Test <em>italic</em></p>'},
|
||||
{input: 'T\n#**Denmark**',
|
||||
expected: '<p>T<br>\n<a class="stream" data-stream-id="1" href="http://zulip.zulipdev.com/#narrow/stream/1-Denmark">#Denmark</a></p>'},
|
||||
expected: '<p>T<br>\n<a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a></p>'},
|
||||
{input: 'T\n@**Cordelia Lear**',
|
||||
expected: '<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>'},
|
||||
{input: '@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.',
|
||||
@@ -387,7 +387,7 @@ run_test('marked', () => {
|
||||
{input: '@**Bobby <h1>Tables</h1>**',
|
||||
expected: '<p><span class="user-mention" data-user-id="103">@Bobby <h1>Tables</h1></span></p>'},
|
||||
{input: '#**Bobby <h1>Tables</h1>**',
|
||||
expected: '<p><a class="stream-topic" data-stream-id="4" href="http://zulip.zulipdev.com/#narrow/stream/4-Bobby-.3Ch1/topic/Tables.3C.2Fh1.3E">#Bobby <h1 > Tables</h1></a></p>'},
|
||||
expected: '<p><a class="stream-topic" data-stream-id="4" href="/#narrow/stream/4-Bobby-.3Ch1/topic/Tables.3C.2Fh1.3E">#Bobby <h1 > Tables</h1></a></p>'},
|
||||
];
|
||||
|
||||
// We remove one of the unicode emoji we put as input in one of the test
|
||||
|
||||
Reference in New Issue
Block a user