oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1package notionmd
2
3// runFixtures is one fixture per row of §11.1 to §11.3.
4func runFixtures() []fixture {
5 return append(append(markFixtures(), linkFixtures()...),
6 mentionFixtures()...)
7}
8
9func markFixtures() []fixture {
10 return []fixture{
11 page("marks", para(txt("plain "), bold("bold"), txt(" "),
12 italic("italic"), txt(" "), both("both"), txt(" "),
13 codeRun("code"))),
14 page("marks-lost", para(Run{Type: "text", Text: "struck",
15 Strike: true}, txt(" "), Run{Type: "text", Text: "under",
16 Underline: true}, txt(" "), Run{Type: "text", Text: "red",
17 Color: "red"}, txt(" "), Run{Type: "text", Text: "shaded",
18 Color: "yellow_background"})),
19 page("marks-partly-italic", para(bold("a "), both("b"),
20 bold(" c"))),
21 page("marks-edge-space", para(txt("x"), bold(" spaced "),
22 txt("y"))),
23 page("marks-star", para(bold("5*3"), txt(" and "),
24 italic("a*b"))),
25 page("marks-code-backtick", para(codeRun("a `tick`"),
26 txt(" then "), codeRun("ok"))),
27 page("marks-around-link", para(bold("see "),
28 Run{Type: "text", Text: "this", Bold: true,
29 Link: "https://example.com/x"}, bold(" too"))),
30 page("marks-across-lines", para(bold("first\nsecond"))),
31 page("marks-address-runs-on", para(bold("docs at "+
32 "https://example.com/x."))),
33 page("marks-equation", para(txt("inline "),
34 Run{Type: "equation", Text: "x^2", Expression: "x^2"})),
35 }
36}
37
38func linkFixtures() []fixture {
39 acme := hexID("ac1e")
40 compact := "0000000000000000000000000000ac1e"
41 return []fixture{
42 page("links-web", para(linked("a link", "https://example.com/a"),
43 txt(" "), linked("mail", "mailto:ana@example.com"), txt(" "),
44 linked("Foo", "https://en.wikipedia.org/wiki/Foo_(bar)"),
45 txt(" "), linked("a [label]", "https://example.com/b"),
46 txt(" "), linked("", "https://example.com/empty"), txt(" "),
47 linked("bad", "javascript:alert(1)"), txt(" "),
48 linked("spaced", "https://example.com/a b"))),
49 page("links-notion", para(
50 linked("Acme page", "https://www.notion.so/Acme-"+compact),
51 txt(" "), linked("site", "https://ws.notion.site/"+compact),
52 txt(" "), linked("bare", "/"+compact),
53 txt(" "), linked("block", "https://notion.so/"+compact+"#b1"),
54 txt(" "), linked("Acme", "https://www.notion.so/"+compact))).
55 live(acme, "Acme"),
56 page("links-notion-not-imported", para(linked("elsewhere",
57 "https://www.notion.so/Other-0000000000000000000000000000beef"),
58 txt(" "), linked("gone", "https://www.notion.so/"+
59 "0000000000000000000000000000dead"))).
60 state(hexID("dead"), "dead"),
61 }
62}
63
64func mentionFixtures() []fixture {
65 return []fixture{
66 page("mentions-pages", para(mention("page", hexID("1"), "Acme"),
67 txt(" "), mention("page", hexID("2"), "Old name"), txt(" "),
68 mention("page", hexID("3"), "Untitled"), txt(" "),
69 mention("page", hexID("4"), "Deleted one"), txt(" "),
70 mention("page", hexID("5"), "A row"), txt(" "),
71 mention("database", hexID("6"), "Projects"), txt(" "),
72 mention("database", hexID("7"), "Untitled"))).
73 live(hexID("1"), "Acme", hexID("2"), "Acme (Notion)").
74 state(hexID("4"), "dead").state(hexID("5"), "row").
75 state(hexID("6"), "database"),
76 page("mentions-dates", para(dated("2026-11-12", "", ""), txt(", "),
77 dated("2026-11-12T14:00:00.000+00:00", "", ""), txt(", "),
78 dated("2026-11-12T09:30:00.000", "", "America/New_York"),
79 txt(", "), dated("2026-11-12", "2026-11-14", ""), txt(", "),
80 dated("2026-11-12T23:30:00.000Z", "2026-11-13T01:00:00.000Z",
81 ""), txt(", "), dated("someday", "", ""))),
82 page("mentions-other", para(
83 Run{Type: "mention", Text: "@Ana", Mention: &Mention{
84 Type: "user", ID: "u1", Name: "Ana"}}, txt(" "),
85 Run{Type: "mention", Text: "@Anonymous", Mention: &Mention{
86 Type: "user", ID: "u2"}}, txt(" "),
87 Run{Type: "mention", Text: "https://github.com/x/y/issues/2",
88 Mention: &Mention{Type: "link_preview",
89 URL: "https://github.com/x/y/issues/2"}}, txt(" "),
90 Run{Type: "mention", Text: "@Today", Mention: &Mention{
91 Type: "template_mention"}}, txt(" "),
92 Run{Type: "mention", Text: ":party:", Mention: &Mention{
93 Type: "custom_emoji"}})),
94 }
95}
96