Commit graph

50 commits

Author SHA1 Message Date
Steven
48ce4ccc26 fix(web): disable setext header syntax (#5314)
Add custom remark plugin to prevent setext headers (headers using === or --- underlines) from being recognized by the markdown parser. The plugin disables the setextUnderline construct at the micromark parser level.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 09:07:54 +08:00
Steven
4668c4714b refactor(web): improve MemoContent security and maintainability
Security improvements:
- Add rehype-sanitize for XSS protection in markdown content
- Remove DOMPurify and deprecated __html code block feature
- Extract sanitize schema to constants with comprehensive documentation

Maintainability improvements:
- Extract SANITIZE_SCHEMA to constants.ts for better organization
- Create utils.ts with shared code extraction utilities
- Refactor CodeBlock and MermaidBlock to use shared utilities
- Rename PreProps to CodeBlockProps for clarity
- Reduce code duplication across components

Dependency cleanup:
- Remove explicit katex dependency (now transitive via rehype-katex)
- Remove @matejmazur/react-katex (unused)
- Remove dompurify (replaced by rehype-sanitize)
- Update vite config to remove katex-vendor chunk

Changes: 7 files changed, 84 insertions(+), 100 deletions(-)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:45:22 +08:00
Steven
d9f8bc80f0 feat(web): add LaTeX math rendering support to MemoContent
Integrates remark-math and rehype-katex plugins to enable LaTeX mathematical expressions in memos. Users can now write inline math ($...$) and display math ($$...$$) using standard LaTeX syntax.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:08:45 +08:00
Johnny
1ef11f7470 refactor: implement MemoView component with subcomponents and hooks
- Added MemoView component to display a single memo card with full functionality including creator info, memo content, attachments, reactions, and comments.
- Created MemoBody and MemoHeader subcomponents to separate concerns and improve maintainability.
- Introduced custom hooks for managing memo actions, keyboard shortcuts, NSFW content visibility, and image preview.
- Implemented reaction handling with new ReactionSelector and ReactionView components.
- Added TypeScript types for better type safety and clarity.
- Established constants for memo card styling and keyboard shortcuts.
- Removed legacy ReactionSelector and ReactionView components from the previous structure.
2025-11-29 23:21:35 +08:00
Steven
5a16f8009f fix(markdown): render single newlines as line breaks
Add remark-breaks plugin to render single newlines as <br> tags,
matching GitHub Flavored Markdown behavior.

Fixes https://github.com/usememos/memos/issues/5277

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:13:57 +08:00
Steven
d30ff2898f fix(web): correct task checkbox toggling in multi-section memos
Fixed a bug where clicking checkboxes in task lists would toggle the wrong
checkbox when a memo contained multiple sections with separate task lists.

The issue was that TaskListItem was counting tasks only within the immediate
parent list (ul/ol), but the toggleTaskAtIndex function counts all tasks
globally across the entire memo. This caused index misalignment.

Changes:
- Add containerRef to MemoContentContext for proper task scoping
- Pass memoContentContainerRef through context in MemoContent component
- Update TaskListItem to count all tasks within the container scope

This ensures task indices are calculated consistently with the markdown
manipulation logic, fixing checkbox toggling in complex multi-section memos.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 09:25:15 +08:00
Steven
d693142dd4 feat(web): enhance code blocks with copy button and fix link navigation
Add custom code block renderer with language display and copy functionality. Links now open in new windows, and clicking image links no longer triggers both link navigation and image preview.

- Add CodeBlock component with copy-to-clipboard button and language label
- Configure all markdown links to open in new windows with target="_blank"
- Fix image link behavior to prevent duplicate actions when clicked

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 22:06:07 +08:00
Claude
596b894ca0 chore: remove unused syntax
- Removed the wikilink extension from markdown services in test and API service.
- Deleted the DefaultLink and WikiLink components, simplifying link handling.
- Updated ConditionalComponent to remove wikilink checks.
- Adjusted MemoContent to exclude wikilink handling in markdown rendering.
- Refined markdown styles for compact rendering, enhancing readability.
- Added a Markdown Styling Guide to document the new compact styling approach.
2025-10-27 08:31:57 +08:00
Claude
739fd2cde6 refactor: update markdown parser
- Removed the `nodes` field from the `Memo` interface in `memo_service.ts`.
- Updated the `createBaseMemo` function and the `Memo` message functions to reflect the removal of `nodes`.
- Cleaned up the serialization and deserialization logic accordingly.

chore: remove code-inspector-plugin from Vite configuration

- Deleted the `codeInspectorPlugin` from the Vite configuration in `vite.config.mts`.
- Simplified the plugins array to include only `react` and `tailwindcss`.
2025-10-26 11:28:40 +08:00
Johnny
f907619752 chore: move frontend store 2025-07-07 22:44:08 +08:00
Johnny
3426a791b6 chore: update tag styles 2025-07-07 08:58:09 +08:00
Johnny
91be2f68d1
feat: variant colors (#4816) 2025-07-04 23:03:13 +08:00
Johnny
493832aeb4 refactor: unify components 2025-07-01 19:29:48 +08:00
Johnny
f5c64849d2 chore: upgrade tailwindcss to v4 2025-06-07 10:15:12 +08:00
Steven
785c250f3c refactor: migrate memo store 2025-05-27 08:26:13 +08:00
johnnyjoy
0b85cb567e chore(frontend): fix clsx 2025-02-01 22:04:29 +08:00
johnnyjoy
1caaef1c5b chore: fix memo compact mode 2025-01-10 21:47:00 +08:00
Query&mut NinjaStyle, &Ryder
972ebbae2f
fix: compact mode storage (#4279)
fix #4274 now when checkbox is toggled the memo remembers the compact state

Co-authored-by: root <root@DESKTOP-G3MCU14>
2025-01-10 20:43:46 +08:00
Chris Curry
d81174ad7c
feat: optimize filters sync (#4260)
* refactor: add bi-directional filters sync between filterStore and searchParams

* fix: tag redirection from memos detail page, https://github.com/usememos/memos/issues/4232
2025-01-04 23:42:49 +08:00
RoccoSmit
54ee2bf3ab
feat: show less when memo expanded (#4143)
* Added show less action and language files

* Renaming type as suggested in pr review
2024-11-24 22:24:58 +08:00
Steven
952428c15d chore: update default max height 2024-10-15 20:38:17 +08:00
Steven
c4b52c68b5 fix: max height of memo content compact mode 2024-10-15 20:07:55 +08:00
Steven
ea881338a9 chore: add gradient block to compact mode 2024-09-22 21:15:46 +08:00
johnnyjoy
40d59fc47a chore: fix user role checks 2024-09-02 21:04:25 +08:00
Steven
0f4b7c5f4a feat: add more memo settings 2024-05-29 23:17:53 +08:00
Steven
155c5baf2c refactor: add markdown service 2024-04-29 08:00:37 +08:00
Steven
d8aeec993c chore: replace classnames with clsx 2024-04-28 00:58:40 +08:00
Steven
d84a88e805 chore: fix linter 2024-03-30 00:05:19 +08:00
Steven
c7aaf791e6 chore: tweak props naming 2024-03-29 22:49:19 +08:00
Steven
16cfef32d6 chore: tweak statistics translation 2024-03-26 23:49:37 +08:00
Steven
722e356044 chore: update memo store 2024-03-19 20:55:33 +08:00
Steven
86db6d0254 chore: tweak user api definition 2024-03-18 12:56:52 +08:00
Steven
f3fb5e0c60 chore: tweak route enum 2024-03-18 12:07:44 +08:00
Steven
0f48cfbb4e chore: tweak padding styles 2024-03-15 08:52:11 +08:00
Steven
ab136e3310 chore: tweak styles 2024-03-15 00:12:22 +08:00
Steven
15be18fa85 chore: update compace mode handler 2024-03-14 09:07:18 +08:00
Steven
2516431b20 chore: tweak memo content styles 2024-03-14 00:01:33 +08:00
Steven
ded4da07a3 feat: use @github/relative-time-element to display time 2024-03-13 23:47:34 +08:00
Steven
7d5f603482 chore: update compact view 2024-03-04 11:21:48 +08:00
Steven
8ce6a32aac feat: use gomark wasm in frontend 2024-01-31 22:25:24 +08:00
Steven
28c7a75ea2 chore: fix import nodes 2024-01-30 22:15:05 +08:00
Steven
196facfacd feat: implement embedded resource renderer 2024-01-20 09:17:31 +08:00
Steven
8a34013558 feat: implement embedded memo renderer 2024-01-20 01:56:10 +08:00
Steven
893dd2c85e chore: add disable filter to renderer context 2024-01-18 14:52:57 +08:00
Steven
5ebbed9115 chore: handle tag click 2024-01-15 08:15:34 +08:00
Steven
0c52f1ee6a chore: tweak home style 2024-01-12 08:08:24 +08:00
Steven
d2a9aaa9d4 chore: update line break renderer 2024-01-05 09:18:37 +08:00
Steven
454cd4e24f feat: implement switchable task list node 2024-01-05 08:40:16 +08:00
Steven
ea87a1dc0c chore: update memo content props 2023-12-28 22:57:51 +08:00
Steven
a3feeceace chore: remove component v1 suffix 2023-12-22 08:29:02 +08:00
Renamed from web/src/components/MemoContentV1/index.tsx (Browse further)