-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix(build): Separate markdown and html handling into stages #1675
base: v4
Are you sure you want to change the base?
Conversation
Ok one thing missing is aliases don't contribute to the graph/backlinks, will try to figure that one out bit later |
198b494
to
ecd78b1
Compare
In this forcepush I actually found a slightly better place to augment the Looking for the graph/backlinks fix, which is the last thing remaining for the aliases to not have any issues whatsoever |
Found an issue that I'm not sure I can fix - for Currently there seems to be a data race where some html links are generated before the frontmatter transformer runs on their target and puts its aliases into I guess I can make a hacky fix for this - at least for myself - by running a custom pre-pass on all content that parses the frontmatter only to get the aliases from it and populates |
I did the split I mentioned - and it completely fixed the issue, now I'm happy, aliases work fantastically now. But I had to write a very crude hack to make the Feel free to ignore the last commit - although, well, the first commit kinda depends on it to not be broken. Sadly the third commit (fixing the graph/backlinks) also depends on the first one 🤷 Anyway, I think I'm done here, you may merge this and live with the hack, or people may use this MR if they need working aliases I guess |
I'm so confused about this PR, what is broken? can you write a simple case where it doesn't work? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, but this PR seems all over the places, it felt like you tried to include 3 different things in here.
How does alias fixes related to the change in parse?
and the worker seems to be a completely different PR.
That's why it's split into 4 commits?.. Ah yeah github has not the best review UI, it'd make way more sense if you look at commits one by one if you didn't do that.
Uhm, oh yeah you also probably didn't read full commit messages, there's a bit more details there.
Sure, so make a page in a folder, for example
|
I do agree actually (well at least it's a separate commit), but the first commit is kind of broken without it. OTOH the first commit doesn't make things worse - although less consistent. Also I made like seven small fix PRs, I felt it makes sense to at least group all the alias fixes in one 😂 |
You can still separate into different PR, then mention it in the description to tell us what the order for merging. |
fwiw I don't think we don't have to separate the parser. If you want to update the allSlugs then we can just do it in the frontmatter transformers. at this point, frontmatter is considered to be the core regardless and always get parsed first so you can assume all of the de/alias and frontmatter item will get propagated there. Not sure what you meant by "transformers for markdown and html will be parsed separately" here. we should run all markdownplugins => htmlplugins |
Right now, "markdownplugins => htmlplugins" runs for every file, but not for all files separately. So for two pages A and B this is the order of what currently happens: What has to happen for allSlugs thing to work correctly is: This is because I hope that answers the questions of why I had to separate the parser in two stages, and how it's unavoidable |
GitHub is actually awful for stacked (dependent on one another) PRs. So right now we have 4 commits here:
If you insist on making separate PRs here's my plan:
edit: |
ae891ef
to
1ae1f30
Compare
Split this thing into 4 PRs with some of them depending on others, it does indeed look a bit nicer I guess (I mean the diff view are the same as if you'd look at the commits in one PR separately). I'm assuming you're ok with leaving the |
passby review to say this is nice, aliases didnt get much thought put into it so thanks for trying to fix it haha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny things, otherwise lgtm
// this is a hack | ||
// we assume markdown parsers can add to `allSlugs`, | ||
// but don't actually use them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a big assumption imho.
I think there is no preventing users from using allSlugs in markdown in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the thing is if some markdown transformer adds to allSlugs and some other uses allSlugs - there will always be ordering issues similar to what I'm trying to prevent with html
So basically it makes little sense to do that.
This could kind of be fixed by assigning priorities to transformers and then doing multiple stages for all files (again literally the same thing as I'm doing with html, but multiple times), but that's a whole lot of work for no gain as we don't use that anyway.
And what I just said also makes no sense with workers as we actually need to have a concurrently shared list that different workers need to add to and read from(!) which I've no idea how to do (imagine having normal threads and synchronization tools in node) - and again, a whole lotta complexity for "correctness", or this little (but very ugly) hack we have here 😅
Actually this ugly hack will still work lol, so yeah, we can have the priorities thing, but we don't need it thankfully, as only splitting md and html processors was enough
This coincidentally is also a requirement for dataview lol (yes I'm looking into it) The dataview transformer needs to know the frontmatter (and parse the content for inline fields) of all the files 🙃 |
1ae1f30
to
f28ba5b
Compare
Figured why the types didn't align -
Undid that because it was breaking at least the GFM plugin and I've no mental capacity to look into that eh |
fb91766
to
ff19670
Compare
Hey, is there anything left for me to do to get this (and all the other things I did on top lul) merged? Would love to stop being on top of an unholy megamerge of a dozen of my little fixes/features locally 😂 There are more fixes/features I plan to push that depend on things I already pushed too (not depend depend, but dealing with like conflicts and such could be annoying) edit: Oh wait I literally did not realise it's christmas/new year holidays, no pressure lol 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finals few
ff19670
to
0226692
Compare
First run all markdown transformers on all files, and then run all html transformers on all files. This allows us to augment `allSlugs` from a markdown processor, so that we can add alias slugs from frontmatter, to be later used in the linker html processor when transforming links. For this to work with workers I had to write a very cringe hack. To be able to build the allSlugs list correctly not only from filenames, but also from frontmatter without such measures would require a complete build process overhaul I feel like.
0226692
to
6a05545
Compare
So aliases were completely broken imoThere's #904, where obsidian-like wikilink resolution ("shortest") didn't work for aliases - which was an easy, if hacky, fix - if there is a better way to augmentallSlugs
I'm all ears.And then the HTML redirect was breaking SPA and popovers for which I managed to figure out a simple fix actually.Now aliases work great, I'm very pleased 🙃First run all markdown transformers on all files, and then run all
html transformers on all files.
This allows us to augment
allSlugs
from a markdown processor, so thatwe can add alias slugs from frontmatter, to be later used in the linker
html processor when transforming links.
For this to work with workers I had to write a very cringe hack.
To be able to build the allSlugs list correctly not only from filenames,
but also from frontmatter without such measures would require a complete
build process overhaul I feel like.