You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
@@ -91,6 +91,16 @@ const markdownUtils = {
|
||||
|
||||
return output.join('\n');
|
||||
},
|
||||
|
||||
titleFromBody(body) {
|
||||
if (!body) return '';
|
||||
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);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = markdownUtils;
|
||||
|
||||
Reference in New Issue
Block a user