Fix tribute related bug

This commit is contained in:
SleeplessOne1917 2024-08-01 14:38:17 -04:00
parent 6754c08902
commit 969d5a1f7b
3 changed files with 318 additions and 468 deletions

View file

@ -28,10 +28,10 @@
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-transform-class-properties": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/plugin-transform-typescript": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/preset-typescript": "^7.24.7",
"@babel/runtime": "^7.24.7",
"@babel/runtime": "^7.25.0",
"@emoji-mart/data": "^1.2.1",
"autosize": "^6.0.1",
"babel-loader": "^9.1.3",
@ -48,10 +48,10 @@
"emoji-mart": "^5.6.0",
"emoji-short-name": "^2.0.0",
"express": "~4.19.2",
"highlight.js": "^11.9.0",
"highlight.js": "^11.10.0",
"history": "^5.3.0",
"html-to-text": "^9.0.5",
"i18next": "^23.11.5",
"i18next": "^23.12.2",
"inferno": "^8.2.3",
"inferno-create-element": "^8.2.3",
"inferno-helmet": "^5.2.1",
@ -60,7 +60,7 @@
"inferno-router": "^8.2.3",
"inferno-server": "^8.2.3",
"jwt-decode": "^4.0.0",
"lemmy-js-client": "0.19.4",
"lemmy-js-client": "0.20.0-alpha.1",
"lodash.isequal": "^4.5.0",
"markdown-it": "^14.1.0",
"markdown-it-bidi": "^0.1.0",
@ -73,12 +73,12 @@
"markdown-it-sub": "^2.0.0",
"markdown-it-sup": "^2.0.0",
"mini-css-extract-plugin": "^2.9.0",
"qreator": "^9.2.0",
"qreator": "^9.3.0",
"register-service-worker": "^1.7.2",
"run-node-webpack-plugin": "^1.3.0",
"rxjs": "^7.8.1",
"sanitize-html": "^2.13.0",
"sass": "^1.77.4",
"sass": "^1.77.8",
"sass-loader": "^16.0.0",
"serialize-javascript": "^6.0.2",
"service-worker-webpack": "^1.0.0",
@ -86,13 +86,13 @@
"tippy.js": "^6.3.7",
"toastify-js": "^1.12.0",
"tributejs": "^5.1.3",
"webpack": "^5.91.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@eslint/js": "^9.4.0",
"@babel/core": "^7.25.2",
"@eslint/js": "^9.8.0",
"@types/autosize": "^4.0.3",
"@types/bootstrap": "^5.2.10",
"@types/cookie": "^0.6.0",
@ -100,34 +100,34 @@
"@types/express": "^4.17.21",
"@types/html-to-text": "^9.0.4",
"@types/lodash.isequal": "^4.5.8",
"@types/markdown-it": "^14.1.1",
"@types/markdown-it": "^14.1.2",
"@types/markdown-it-container": "^2.0.10",
"@types/node": "^20.14.2",
"@types/node": "^22.0.2",
"@types/path-browserify": "^1.0.2",
"@types/sanitize-html": "^2.11.0",
"@types/serialize-javascript": "^5.0.4",
"@types/toastify-js": "^1.12.3",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9.4.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-inferno": "^7.34.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"globals": "^15.3.0",
"husky": "^9.0.11",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.9.0",
"husky": "^9.1.4",
"import-sort-style-module": "^6.0.0",
"lint-staged": "^15.2.5",
"prettier": "^3.3.1",
"lint-staged": "^15.2.7",
"prettier": "^3.3.3",
"prettier-plugin-import-sort": "^0.0.7",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-packagejson": "^2.5.0",
"qs": "^6.12.1",
"rimraf": "^6.0.0",
"prettier-plugin-packagejson": "^2.5.1",
"qs": "^6.13.0",
"rimraf": "^6.0.1",
"sortpack": "^2.4.0",
"style-loader": "^4.0.0",
"terser": "^5.31.0",
"typescript": "^5.4.5",
"terser": "^5.31.3",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0",
"typescript-language-server": "^4.3.3",
"webpack-bundle-analyzer": "^4.10.2",

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,9 @@ import markdown_it_highlightjs from "markdown-it-highlightjs/core";
import { Renderer, Token } from "markdown-it";
import { instanceLinkRegex, relTags } from "./config";
import { lazyHighlightjs } from "./lazy-highlightjs";
import Tribute from "tributejs";
import { isBrowser } from "@utils/browser";
export let Tribute: any;
export let md: MarkdownIt = new MarkdownIt();
@ -38,6 +40,10 @@ export let customEmojisLookup: Map<string, CustomEmojiView> = new Map<
CustomEmojiView
>();
if (isBrowser()) {
Tribute = await import("tributejs");
}
export function mdToHtml(text: string, rerender: () => void) {
return { __html: lazyHighlightjs.render(md, text, rerender) };
}