mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
21 lines
428 B
TypeScript
21 lines
428 B
TypeScript
import 'hydrooj';
|
|
import TurndownService from 'turndown';
|
|
|
|
declare module 'hydrooj' {
|
|
interface Lib {
|
|
convertHTML: (str: string) => string,
|
|
}
|
|
}
|
|
|
|
const turndownService = new TurndownService({
|
|
headingStyle: 'atx',
|
|
codeBlockStyle: 'fenced',
|
|
bulletListMarker: '-',
|
|
});
|
|
|
|
export function convertHTML(html: string) {
|
|
return turndownService.turndown(html);
|
|
}
|
|
|
|
global.Hydro.lib.convertHTML = convertHTML;
|