1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-26 12:02:59 +02:00

All: Partially reverts (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
This commit is contained in:
Laurent Cozic 2020-11-23 16:52:17 +00:00
parent c213d5056c
commit 3f2fe79151
2 changed files with 20 additions and 20 deletions
packages
app-cli/tests
renderer

@ -147,27 +147,27 @@ describe('MdToHtml', function() {
expect(result.html.trim()).toBe('<div id="rendered-md"><p>just <strong>testing</strong></p>\n</div>'); expect(result.html.trim()).toBe('<div id="rendered-md"><p>just <strong>testing</strong></p>\n</div>');
})); }));
it('should render links correctly', asyncTest(async () => { // it('should render links correctly', asyncTest(async () => {
const mdToHtml = newTestMdToHtml(); // const mdToHtml = newTestMdToHtml();
const testCases = [ // const testCases = [
// None of these should result in a link // // None of these should result in a link
['https://example.com', 'https://example.com'], // ['https://example.com', 'https://example.com'],
['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'], // ['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'],
['example.com', 'example.com'], // ['example.com', 'example.com'],
['oo.ps', 'oo.ps'], // ['oo.ps', 'oo.ps'],
['test@example.com', 'test@example.com'], // ['test@example.com', 'test@example.com'],
// Those should be converted to links // // Those should be converted to links
['<https://example.com>', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>https://example.com</a>'], // ['<https://example.com>', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>https://example.com</a>'],
['[ok](https://example.com)', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>ok</a>'], // ['[ok](https://example.com)', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>ok</a>'],
]; // ];
for (const testCase of testCases) { // for (const testCase of testCases) {
const [input, expected] = testCase; // const [input, expected] = testCase;
const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true }); // const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true });
expect(actual.html).toBe(expected); // expect(actual.html).toBe(expected);
} // }
})); // }));
}); });

@ -378,7 +378,7 @@ export default class MdToHtml {
const markdownIt = new MarkdownIt({ const markdownIt = new MarkdownIt({
breaks: !this.pluginEnabled('softbreaks'), breaks: !this.pluginEnabled('softbreaks'),
typographer: this.pluginEnabled('typographer'), typographer: this.pluginEnabled('typographer'),
// linkify: true, linkify: true,
html: true, html: true,
highlight: (str: string, lang: string) => { highlight: (str: string, lang: string) => {
let outputCodeHtml = ''; let outputCodeHtml = '';