You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the block id as an id attribute to all rendered blocks (#8)
* Add id to headings blocks
* Add id to divider blocks
* Add id to paragraph blocks
The decision to link to the wrapper div instead of the paragraph itself
was made because currently when a link to a paragraph which has
children is taken on Notion, Notion highlights both the paragraph and
its children.
I went back and forth on this decision however so if linking to the
paragraph directly proves more useful we should go for it. Linking to
paragraphs directly feels more intuitive to me anyway
* Add id to quote blocks
* Add id to code blocks
* Add id to lists blocks
The decision to put the id on the list items instead of the lists
themselves is a fairly obvious one to me. No idea how would one put
them on the lists anyway
* Add id to image blocks
I put the id on the figure instead of the img tag because I think they
act as one entity and linking to the whole thing makes most sense
This is as opposed to lists where each item acts independently
* Add id to callout blocks
Same as images here, the whole thing is one unified thing
* Add id to unsupported blocks
eprintln!("WARNING: Rendering a paragraph with children doesn't make sense as far as I am aware at least for the English language.\nThe HTML spec is strictly against it (rendering a <p> inside of a <p> is forbidden) but it's part of Notion's spec so we support it but emit this warning.\n\nRendering a paragraph with children doesn't give any indication to accessibility tools that anything about the children of this paragraph are special so it causes accessibility information loss.\n\nIf you have an actual use case for paragraphs inside of paragraphs please open an issue, I would love to be convinced of reasons to remove this warning or of good HTML ways to render paragraphs inside of paragraphs!");
r#"<div><p>Or you can just leave an empty line in between if you want it to leave extra breathing room.</p><div class="indent"><p>You can also create these rather interesting nested paragraphs</p><p class="indent">Possibly more than once too!</p></div></div>"#
717
+
r#"<div id="4f2efd79ae9a4684827c6b69743d6c5d"><p>Or you can just leave an empty line in between if you want it to leave extra breathing room.</p><div id="4fb9dd792fc745b1b3a28efae49992ed" class="indent"><p>You can also create these rather interesting nested paragraphs</p><p id="817c0ca1721a4565ac54eedbbe471f0b" class="indent">Possibly more than once too!</p></div></div>"#
705
718
);
706
719
assert_eq!(downloadables, vec![]);
707
720
}
@@ -743,7 +756,8 @@ mod tests {
743
756
.unwrap();
744
757
assert_eq!(
745
758
markup,
746
-
"<blockquote>If you think you can do a thing or think you can’t do a thing, you’re right.\n—Henry Ford</blockquote>"
759
+
r#"<blockquote id="191b3d44a37f40c4bb4f3477359022fd">If you think you can do a thing or think you can’t do a thing, you’re right.
r#"<ul><li>This is some cool list<ol><li>It can even contain other lists inside of it<ul><li>And those lists can contain OTHER LISTS!<ol class="indent"><li>Listception</li><li>Listception</li></ol></li></ul></li></ol></li></ul>"#
970
+
r#"<ul><li id="844b3fdf56884f6c91e897b4f0e436cd">This is some cool list<ol><li id="c3e9c471d4b347dcab6a6ecd4dda161a">It can even contain other lists inside of it<ul><li id="55d7294249f649f98adee3d049f682e5">And those lists can contain OTHER LISTS!<ol class="indent"><li id="100116e20a4749038b794ac9cc3a7870">Listception</li><li id="c1a5555a8359499980dc10241d262071">Listception</li></ol></li></ul></li></ol></li></ul>"#
956
971
);
957
972
assert_eq!(downloadables, vec![]);
958
973
}
@@ -1023,8 +1038,8 @@ mod tests {
1023
1038
assert_eq!(
1024
1039
markup,
1025
1040
vec![
1026
-
r#"<figure><img src="media/5ac94d7e-25de-4fa3-a781-0a43aac9d5c4.png"><figcaption>Circle rendered in Bevy</figcaption></figure>"#,
0 commit comments