From 3f2fe79151ce4ba2bf2ee0d8ccd36404d28291b8 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 23 Nov 2020 16:52:17 +0000 Subject: [PATCH] All: Partially reverts #3975 (link rendering) - Reverts the linkify behaviour - URLs will be auto-detected again - Keeps the new soft-break behaviour There are still unsolved issues with regard to the linkify option so it needs further considerations before we change the behaviour. https://discourse.joplinapp.org/t/12620/18?u=laurent --- packages/app-cli/tests/MdToHtml.ts | 38 +++++++++++++++--------------- packages/renderer/MdToHtml.ts | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/app-cli/tests/MdToHtml.ts b/packages/app-cli/tests/MdToHtml.ts index 27db12df7b..2c2ed118a2 100644 --- a/packages/app-cli/tests/MdToHtml.ts +++ b/packages/app-cli/tests/MdToHtml.ts @@ -147,27 +147,27 @@ describe('MdToHtml', function() { expect(result.html.trim()).toBe('

just testing

\n
'); })); - it('should render links correctly', asyncTest(async () => { - const mdToHtml = newTestMdToHtml(); + // it('should render links correctly', asyncTest(async () => { + // const mdToHtml = newTestMdToHtml(); - const testCases = [ - // None of these should result in a link - ['https://example.com', 'https://example.com'], - ['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'], - ['example.com', 'example.com'], - ['oo.ps', 'oo.ps'], - ['test@example.com', 'test@example.com'], + // const testCases = [ + // // None of these should result in a link + // ['https://example.com', 'https://example.com'], + // ['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'], + // ['example.com', 'example.com'], + // ['oo.ps', 'oo.ps'], + // ['test@example.com', 'test@example.com'], - // Those should be converted to links - ['', 'https://example.com'], - ['[ok](https://example.com)', 'ok'], - ]; + // // Those should be converted to links + // ['', 'https://example.com'], + // ['[ok](https://example.com)', 'ok'], + // ]; - for (const testCase of testCases) { - const [input, expected] = testCase; - const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true }); - expect(actual.html).toBe(expected); - } - })); + // for (const testCase of testCases) { + // const [input, expected] = testCase; + // const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true }); + // expect(actual.html).toBe(expected); + // } + // })); }); diff --git a/packages/renderer/MdToHtml.ts b/packages/renderer/MdToHtml.ts index 1f35ec5a95..8fa2bc5c34 100644 --- a/packages/renderer/MdToHtml.ts +++ b/packages/renderer/MdToHtml.ts @@ -378,7 +378,7 @@ export default class MdToHtml { const markdownIt = new MarkdownIt({ breaks: !this.pluginEnabled('softbreaks'), typographer: this.pluginEnabled('typographer'), - // linkify: true, + linkify: true, html: true, highlight: (str: string, lang: string) => { let outputCodeHtml = '';