fix(plugins): html2text format

This commit is contained in:
Artemy
2024-05-14 15:21:39 +03:00
parent 41dab54df3
commit 1d47c66f7d
5 changed files with 18 additions and 13 deletions

View File

@@ -19,10 +19,12 @@
"license": "MIT",
"dependencies": {
"@mozilla/readability": "^0.5.0",
"linkedom": "^0.18.0",
"@txtdot/sdk": "workspace:*"
"@txtdot/sdk": "workspace:*",
"html-to-text": "^9.0.5",
"linkedom": "^0.18.0"
},
"devDependencies": {
"@types/html-to-text": "^9.0.4",
"typescript": "^5.4.5"
}
}

View File

@@ -7,3 +7,9 @@ export const engineList = [
engines.SearX,
engines.Readability,
];
import { compile } from 'html-to-text';
export const html2text = compile({
selectors: [{ selector: 'img', format: 'skip' }],
});

View File

@@ -30,7 +30,6 @@
"dotenv": "^16.3.1",
"ejs": "^3.1.10",
"fastify": "^4.26.2",
"html-to-text": "^9.0.5",
"iconv-lite": "^0.6.3",
"ip-range-check": "^0.2.0",
"json-schema-to-ts": "^3.0.1",
@@ -41,7 +40,6 @@
"devDependencies": {
"@types/dompurify": "^3.0.5",
"@types/ejs": "^3.1.5",
"@types/html-to-text": "^9.0.4",
"@types/jsdom": "^21.1.6",
"@types/micromatch": "^4.0.7",
"clean-css-cli": "^5.6.3",

View File

@@ -1,6 +1,5 @@
import { IAppConfig } from '../types/pluginConfig';
import { engineList } from '@txtdot/plugins';
import { compile } from 'html-to-text';
import { engineList, html2text } from '@txtdot/plugins';
/**
* Configuration of plugins
@@ -8,7 +7,7 @@ import { compile } from 'html-to-text';
*/
const plugin_config: IAppConfig = {
engines: [...engineList],
html2text: compile(),
html2text,
};
export default plugin_config;