Skip to content

Commit

Permalink
Doing more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkyebrahim2514 committed Dec 11, 2024
1 parent 06b8657 commit 73389cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const imageContainerStyle = (align: string): React.CSSProperties => {
}
}

export const customImagePlugin = () => {
export const customImage = () => {
return function (tree: Nodes) {
visit(tree, 'paragraph', (node: Nodes) => {
let nodeFullText = toString(node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const captureNewline = (node: Node): customType => ({
children: [],
data: {
hProperties: {
style: "margin: 0.5rem 0; display: block;"
style: "margin: 0.5rem 0; display: grid;"
}
}
} as any)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { customText } from './customText';
export { customBlockquote } from './customBlockquote';
export { customHighlightText } from './customHighlightText';
export { customImagePlugin } from './customImage';
export { customImage } from './customImage';
12 changes: 4 additions & 8 deletions react-frontend/src/components/HTMLMarkdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import ReactMarkdown, { Components } from 'react-markdown';
import remarkGfm from 'remark-gfm';
import remarkBreaks from 'remark-breaks'
import remarkDirective from 'remark-directive'
import remarkDirectiveRehype from 'remark-directive-rehype'
import HrMarkdown from './HrMarkdown';
import UlMarkdown from './UlMarkdown';
import LiMarkdown from './LiMarkdown';
import HeadingMarkdown from './HeadingMarkdown';
import SpanMarkdown from './SpanMarkdown';
import BlockquoteMarkdown from './BlockquoteMarkdown';
import AncherLinkMarkdown from './AncherLinkMarkdown';
import { customBlockquote, customHighlightText, customImagePlugin, customText } from './customPlugins';
import { customBlockquote, customHighlightText, customImage, customText } from './customPlugins';

type Props = {
readonly markdown: string
Expand All @@ -36,11 +34,9 @@ function HTMLMarkdown({ markdown }: Props) {
return (
<ReactMarkdown
remarkPlugins={[
// remarkGfm,
// remarkBreaks,
// remarkDirective,
// remarkDirectiveRehype,
customImagePlugin,
remarkGfm,
remarkBreaks,
customImage,
customText,
customHighlightText,
customBlockquote
Expand Down

0 comments on commit 73389cd

Please sign in to comment.