Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automatically link @mentions #1571

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion VocaDbWeb/New/components/Markdown/MarkownRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import remarkBreaks from 'remark-breaks';
import remarkMentions from 'remark-mentions';
import parse from '@/Helpers/markdown';
import { TypographyStylesProvider } from '@mantine/core';

Expand All @@ -14,10 +15,12 @@ export default function MarkdownRenderer({ children }: MarkdownProps) {
const processer = unified()
.use(remarkParse)
.use(remarkBreaks)
.use(remarkMentions, { usernameLink: (username) => `/Profile/${username}` })
.use(remarkRehype)
.use(rehypeStringify);

return (
<TypographyStylesProvider className="description">
<TypographyStylesProvider fz="sm" className="description">
{parse(String(processer.processSync(children)))}
</TypographyStylesProvider>
);
Expand Down
159 changes: 159 additions & 0 deletions VocaDbWeb/New/package-lock.json

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

1 change: 1 addition & 0 deletions VocaDbWeb/New/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"rehype-sanitize": "^5.0.1",
"rehype-stringify": "^9.0.3",
"remark-breaks": "^3.0.3",
"remark-mentions": "^1.0.2",
"remark-parse": "^10.0.2",
"remark-rehype": "^10.1.0",
"sharp": "^0.32.1",
Expand Down