Move to a real markdown parser #1

Open
opened 2022-07-08 22:21:38 +00:00 by toast · 3 comments
Owner

There is https://akkoma.dev/sfr/marked-mfm, though it may need changes or forking for use.
Another possibility is forking https://github.com/commonmark/commonmark.js or writing a moo+nearley parser, but this should only be considered if neither of the above work (commonmark is not a particularly easy to parse language).

There is https://akkoma.dev/sfr/marked-mfm, though it may need changes or forking for use. Another possibility is forking https://github.com/commonmark/commonmark.js or writing a moo+nearley parser, but this should only be considered if neither of the above work (commonmark is not a particularly easy to parse language).
toast added this to the (deleted) project 2022-07-08 22:21:38 +00:00
Owner

I think this would be a chance to rework recognition of mentions which is currently a bit annoying because of recognizing mentions where it should not. For example in shell prompts, email addresses and matrix handles.

I think we could use this JavaScript RegExp to find mentions in a piece of text:

/(?<=^|\s)@([-.\w]+(?:@\w+(?:\.\w+)*)?)(?=\s|$)/gu

Perhaps it would also make sense to refactor the API for creating notes a bit: Replace the noExtractMentions parameter with something where you can pass in a list of mentions (and maybe their text representation separately like in ActivityStreams tag by convention?). If we want to do that we could also pass in a list of mentions into the MFM parser to make it understand if something should be recognized as a mention or not.

Also checking if a mention extracted with the regex are accounts that actually exist.

I think this would be a chance to rework recognition of mentions which is currently a bit annoying because of recognizing mentions where it should not. For example in shell prompts, email addresses and matrix handles. I think we could use this JavaScript `RegExp` to find mentions in a piece of text: ```javascript /(?<=^|\s)@([-.\w]+(?:@\w+(?:\.\w+)*)?)(?=\s|$)/gu ``` Perhaps it would also make sense to refactor the API for creating notes a bit: Replace the `noExtractMentions` parameter with something where you can pass in a list of mentions (and maybe their text representation separately like in ActivityStreams `tag` by convention?). If we want to do that we could also pass in a list of mentions into the MFM parser to make it understand if something should be recognized as a mention or not. Also checking if a mention extracted with the regex are accounts that actually exist.
norm referenced this issue from a commit 2022-08-28 14:46:46 +00:00
norm closed this issue 2022-08-28 14:46:46 +00:00
Owner

Oop that was another #1 I guess.

Oop that was another `#1` I guess.
Johann150 added the
fix
label 2022-12-23 10:22:05 +00:00
Johann150 removed this from the (deleted) project 2022-12-23 10:22:08 +00:00
Owner

I think a good first step would be to render Pages as Markdown, since that does not require any server side processing.

I think a good first step would be to render Pages as Markdown, since that does not require any server side processing.
Sign in to join this conversation.
No Label
feature
fix
upkeep
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#1
No description provided.