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

Markdown Parser Rework #1496

Open
wants to merge 14 commits into
base: v4
Choose a base branch
from

Conversation

@saberzero1 saberzero1 mentioned this pull request Oct 9, 2024
45 tasks
@saberzero1 saberzero1 marked this pull request as ready for review October 9, 2024 18:59
@saberzero1
Copy link
Collaborator Author

saberzero1 commented Oct 9, 2024

@aarnphm Just a quick check if this direction is okay before I continue implementing the fixes for the 10+ open issues related to transformers.

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 10, 2024

that is, a lot of change :)

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 10, 2024

probably cc @jackyzha0 once he has bandwidth

source of this change is from #1424

@saberzero1
Copy link
Collaborator Author

that is, a lot of change :)

Yeah, in its current form, it merely breaks up every text/markdown/html parsing step into a separate file, instead of grouping them.

probably cc @jackyzha0 once he has bandwidth

source of this change is from #1424

This can be resolved by adding a markdown parser for non-wikilinks. Users could choose to use the non-wikilink parser over the wikilink parser should they prefer that functionality.

It believe it also makes parser more extendable.

Having said that, I am aware this is a breaking change, but I am not entirely sure if it is possible to make it a non-breaking change. However, I think configuration could probably be done in a more sophisticated manner.

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 10, 2024

source of this change is from #1424

This can be resolved by adding a markdown parser for non-wikilinks. Users could choose to use the non-wikilink parser over the wikilink parser should they prefer that functionality.

We did mention some structural change that you have in this PR in that issues

quartz.config.ts Outdated
],
transformers: {
textTransformers: [
Text.ObsidianFlavoredMarkdownComments(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

sitting on this for a bit, I do think that this is a bit too verbose.

ig this approach is bottom-up given that the transformers are text => markdown => html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Verbose as in function naming? That can be resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i mean having users too much control and customization (naming is a byproduct ig).

if we gave them a "gun" they will eventually end up shooting themselves in their foot.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see what you mean.

Having said that, most users shouldn't be touching their parsers anyway. And despite the many questions in the Discord, I have yet to get one about parsers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i mean having users too much control and customization (naming is a byproduct ig).

if we gave them a "gun" they will eventually end up shooting themselves in their foot.

I have given it some thought. We could create 4 (text, markdown, HTML, external resources) "parsers" that just call the default parsing order.

That would make it easy for most users, while still allowing advanced users full customization.

@@ -0,0 +1,23 @@
import remarkGfm from "remark-gfm"
Copy link
Collaborator

Choose a reason for hiding this comment

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

quick comment: we can move in transformers in folders, so we don't have to have the prefix in each of these files

@KristofKekesi
Copy link

Maybe #1647 would be a related bug to fix in this branch.
Thanks for working on Quartz, this rework is huge!

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.

commentRegex renders error when multiple lines
3 participants