fix douban note import

This commit is contained in:
wanxp 2022-06-27 00:42:12 +08:00
parent a1d818af2f
commit bf963ec126
3 changed files with 16 additions and 1 deletions

@ -4,6 +4,7 @@ import DoubanNoteSubject from 'douban/model/DoubanNoteSubject';
import DoubanPlugin from "main";
import { DoubanPluginSettings } from "douban/Douban";
import DoubanSubject from "douban/model/DoubanSubject";
import html2markdown from '@notable/html2markdown';
import { moment } from "obsidian";
export default class DoubanNoteLoadHandler extends DoubanAbstractLoadHandler<DoubanNoteSubject> {
@ -52,7 +53,7 @@ export default class DoubanNoteLoadHandler extends DoubanAbstractLoadHandler<Dou
const result:DoubanNoteSubject = {
image: image,
timePublished: timePublished ? new Date(timePublished) : null,
content: content ? content.toString().replaceAll(`<div class="note">`, "").replaceAll(`</div>`, "").replaceAll(`<br>`, " \n"): "",
content: content ? html2markdown(content.toString()): "",
id: id ? id[0] : "",
type: "Article",
title: title,

13
package-lock.json generated

@ -67,6 +67,14 @@
"fastq": "^1.6.0"
}
},
"@notable/html2markdown": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/@notable/html2markdown/-/html2markdown-1.1.3.tgz",
"integrity": "sha512-+WxHtqtZHqYRx0Zi7dhe+pGhlmds/mi+ZaNO26OJ991+LYGjqskVFa9VRsWfux2keaCkIMXitGgeViSW3wHLag==",
"requires": {
"mime2ext": "^1.0.1"
}
},
"@types/codemirror": {
"version": "0.0.108",
"resolved": "https://registry.npmmirror.com/@types/codemirror/-/codemirror-0.0.108.tgz",
@ -723,6 +731,11 @@
"mime-db": "1.52.0"
}
},
"mime2ext": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/mime2ext/-/mime2ext-1.0.1.tgz",
"integrity": "sha512-GW9keW4FtnqfEn4PltsEiSlfQj3rNAU+nGsvPk8+4kQJpo0tQ7/dCojFYgkPtOD2xk9ePrRqVFUAtPpjzY1Cgw=="
},
"moment": {
"version": "2.29.2",
"resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.2.tgz",

@ -22,6 +22,7 @@
"typescript": "4.7.2"
},
"dependencies": {
"@notable/html2markdown": "^1.1.3",
"axios": "^0.27.2",
"cheerio": "^1.0.0-rc.11",
"douban-search-crack": "^1.0.6",