1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Desktop: Fixes #3009: Word/character counter includes Markdown syntax and HTML tags (#3037)

* Updated commit

* Update package.json

* Update package.json

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
RedDocMD
2020-05-15 15:58:31 +05:30
committed by GitHub
parent 7d767cf0c9
commit a09c7b72c7
6 changed files with 125 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ const stringPadding = require('string-padding');
const urlUtils = require('lib/urlUtils');
const MarkdownIt = require('markdown-it');
const { setupLinkify } = require('lib/joplin-renderer');
const removeMarkdown = require('remove-markdown');
const markdownUtils = {
// Not really escaping because that's not supported by marked.js
@@ -101,6 +102,11 @@ const markdownUtils = {
const title = lines[0].trim();
return title.replace(filterRegex, '').replace(mdLinkRegex, '$1').replace(emptyMdLinkRegex, '$1').substring(0,80);
},
stripMarkdown(text, options = { gfm: false }) {
// Removes Markdown syntax elements from the given text
return removeMarkdown(text, options);
},
};
module.exports = markdownUtils;