Skip to content

Commit

Permalink
Add markdown preview image lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Nov 20, 2024
1 parent 7eb889b commit b558d35
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"lib0": "^0.2.88",
"lodash": "^4.17.21",
"markdown-it": "^14.1.0",
"markdown-it-image-lazy-loading": "^2.0.1",
"markdown-it-incremental-dom": "^2.1.0",
"markdown-it-link-attributes": "^4.0.1",
"markdown-it-prism": "^2.3.0",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/editor/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { refractor } from "refractor";
import markdownItIncrementalDOM from "markdown-it-incremental-dom";
import markdownItSanitizer from "markdown-it-sanitizer";
import markdownItTaskCheckbox from "markdown-it-task-checkbox";
import markdownItImageLazyLoading from "markdown-it-image-lazy-loading";
import mila from "markdown-it-link-attributes";
import * as IncrementalDOM from "incremental-dom";
import "./editor.css";
Expand Down Expand Up @@ -47,7 +48,8 @@ const md = new MarkdownIt({
incrementalizeDefaultRules: false,
})
.use(markdownItKatex)
.use(markdownItSanitizer);
.use(markdownItSanitizer)
.use(markdownItImageLazyLoading);

const Preview = () => {
const currentTheme = useCurrentTheme();
Expand Down
1 change: 1 addition & 0 deletions frontend/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ declare module "markdown-it-incremental-dom";
declare module "markdown-it-sanitizer";
declare module "markdown-it-task-checkbox";
declare module "markdown-it-link-attributes";
declare module "markdown-it-image-lazy-loading";
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b558d35

Please sign in to comment.