You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
First pass at linting lib dir
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
const TurndownService = require('joplin-turndown')
|
||||
const TurndownService = require('joplin-turndown');
|
||||
const markdownUtils = require('lib/markdownUtils');
|
||||
|
||||
class HtmlToMd {
|
||||
|
||||
parse(html, options = {}) {
|
||||
const turndownPluginGfm = require('joplin-turndown-plugin-gfm').gfm
|
||||
const turndownPluginGfm = require('joplin-turndown-plugin-gfm').gfm;
|
||||
const turndown = new TurndownService({
|
||||
headingStyle: 'atx',
|
||||
anchorNames: options.anchorNames ? options.anchorNames.map(n => n.trim().toLowerCase()) : [],
|
||||
codeBlockStyle: 'fenced',
|
||||
})
|
||||
turndown.use(turndownPluginGfm)
|
||||
});
|
||||
turndown.use(turndownPluginGfm);
|
||||
turndown.remove('script');
|
||||
turndown.remove('style');
|
||||
let md = turndown.turndown(html)
|
||||
let md = turndown.turndown(html);
|
||||
if (options.baseUrl) md = markdownUtils.prependBaseUrl(md, options.baseUrl);
|
||||
return md;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = HtmlToMd;
|
||||
module.exports = HtmlToMd;
|
||||
|
||||
Reference in New Issue
Block a user