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

Add Markdown support to the Note node #2044

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

gremlation
Copy link
Contributor

@gremlation gremlation commented Dec 24, 2024

This uses the (MIT licensed) Tiptap rich text editor to add Markdown support for the Note node. All the usual Markdown features are supported.

┆Issue is synchronized with this Notion page by Unito

This uses the [Tiptap](https://tiptap.dev) rich text editor to add
Markdown support for the Note node. All the usual Markdown features are
supported, with the exception of links.
@gremlation gremlation requested a review from a team as a code owner December 24, 2024 18:57
Copy link

socket-security bot commented Dec 24, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@tiptap/[email protected] None +1 2.53 MB _bdbch, nperez0111, patrickbaber, ...2 more
npm/@tiptap/[email protected] None +2 466 kB nperez0111
npm/@tiptap/[email protected] None +20 581 kB nperez0111

View full report↗︎

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please attach screenshots/video clips and explain how this widget should function, e.g. how does the feature switch between edit mode and view mode.

@gremlation
Copy link
Contributor Author

Here's a screen recording. There's no separate edit/view modes, it works just the same as before, you just click in the text area and start typing.

Markdown-demo.mp4

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently if we paste markdown text to the textarea, it is not detected as markdown. Can you fix it? Or I would suggest we have some sort of switching mechanism, i.e. double click textarea to enter edit mode where raw text is shown, and unfocus will show the rendered markdown.

Instead of using the rich-text editing functionality, when you click on
the Markdown widget to edit it, it switches to a plain textarea. When it
loses focus, it switches back to the rendered Markdown view.

Also adds link support. `rel="noopener noreferrer nofollow"` is added by
default.
@gremlation
Copy link
Contributor Author

I've added an edit mode that switches to editing raw Markdown. You should be able to paste Markdown in there. I've also added link support.

Markdown-demo-2.mp4

@huchenlei huchenlei merged commit 7990491 into Comfy-Org:main Dec 26, 2024
9 of 10 checks passed
@gremlation gremlation deleted the note-markdown branch December 26, 2024 18:19
@alessandroperilli
Copy link

Is it me or the markdown support doesn't support rendering tables? @gremlation

@gremlation
Copy link
Contributor Author

Is this necessary @alessandroperilli? There's all sorts of things that could be added (code highlighting, task lists, YouTube embeds, etc.), but I was trying to strike a balance between the things people will actually use and throwing the kitchen sink in.

If this is something you think people will use, I've opened a pull request for table support in #2072

@alessandroperilli
Copy link

@gremlation personally, I use them inside APW. I'd be fine without markdown support for tables, but the problem is that without it, my "homemade tables in plain text" are screwed. So either we go for a modality switch, like MTB's Note+ node does, or I'd like support for them.

As a side node, I also have issues with headings. Somehow, I cannot place 2 headings of the same time in the same node. I have this issue with both # and ## headings.

@gremlation
Copy link
Contributor Author

Okay, cool. The pull request is there then. I just tried the MTB Note+ node and it doesn't work for me at all. Not sure what the problem is.

When you say you have problems with the headings, do you mean with this Note node? It's working for me without a problem. Maybe it's a conflict with another extension? If you think it's a bug and can reproduce it without other extensions enabled, create an issue with debug info like browser version and tag me in it.

Markdown-multiple-headings.mp4

@yoland68
Copy link
Member

yoland68 commented Jan 3, 2025

FYI, this is creating backwards compatibility issues for all Notes that have single line breaks because of Markdown render:

Screen.Recording.mov

@yoland68
Copy link
Member

yoland68 commented Jan 3, 2025

Screenshot

@yoland68
Copy link
Member

yoland68 commented Jan 3, 2025

In my opinion, this should be a new node called "Markdown Note"

@yoland68
Copy link
Member

yoland68 commented Jan 3, 2025

Creating an issue here #2146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants