You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-10-09 22:22:31 +02:00
This commit is contained in:
@@ -216,12 +216,19 @@ const markdownUtils = {
|
||||
|
||||
titleFromBody(body: string) {
|
||||
if (!body) return '';
|
||||
const spaceEntities = / /g;
|
||||
body = body.replace(spaceEntities, ' ');
|
||||
const lines = body.trim().split('\n');
|
||||
const title = lines[0].trim();
|
||||
|
||||
const mdLinkRegex = /!?\[([^\]]+?)\]\(.+?\)/g;
|
||||
const emptyMdLinkRegex = /!?\[\]\((.+?)\)/g;
|
||||
const filterRegex = /^[# \n\t*`-]*/;
|
||||
const lines = body.trim().split('\n');
|
||||
const title = lines[0].trim();
|
||||
return title.replace(filterRegex, '').replace(mdLinkRegex, '$1').replace(emptyMdLinkRegex, '$1').substring(0, 80);
|
||||
return title
|
||||
.replace(filterRegex, '')
|
||||
.replace(mdLinkRegex, '$1')
|
||||
.replace(emptyMdLinkRegex, '$1')
|
||||
.substring(0, 80);
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user