|
| 1 | +--- |
| 2 | +title: Markdown Elements |
| 3 | +hidden: true |
| 4 | +--- |
| 5 | + |
| 6 | +# Markdown Elements |
| 7 | + |
| 8 | +This is for testing all the different kinds of markdown that can exist. Whenever I find a styling edge case that exists, I add it to this document. It’s my form of visual regression for all the different kinds of elements that need to be styled across different contexts. |
| 9 | + |
| 10 | +## Headings |
| 11 | + |
| 12 | +For headings, do we ever go deeper than a heading 4? Do we really need styles for that? |
| 13 | + |
| 14 | +## Heading 2 |
| 15 | + |
| 16 | +### Heading 3 |
| 17 | + |
| 18 | +#### Heading 4 |
| 19 | + |
| 20 | +##### Heading 5 |
| 21 | + |
| 22 | +###### Heading 6 |
| 23 | + |
| 24 | +## Callouts |
| 25 | + |
| 26 | +Callouts can be used with the `<docs-*>` elements. They are specifically for calling special attention to pieces of information outside the normal flow of the document. |
| 27 | + |
| 28 | +There are three supported variations of these elements: |
| 29 | + |
| 30 | +1. `<docs-info>` - For general callouts to bits of information. |
| 31 | +2. `<docs-warning>` - For warning the read about something they should know. |
| 32 | +3. `<docs-error>` - For telling the user they shouldn’t be doing something. |
| 33 | + |
| 34 | +Examples: |
| 35 | + |
| 36 | +<docs-info>`<Link to>` with a `..` behaves differently from a normal `<a href>` when the current URL ends with `/`. `<Link to>` ignores the trailing slash, and removes one URL segment for each `..`. But an `<a href>` value handles `..` differently when the current URL ends with `/` vs when it does not.</docs-info> |
| 37 | + |
| 38 | +<docs-warning>`useMatches` only works with Data Routers, since they know the full route tree up front and can provide all of the current matches. Additionally, `useMatches` will not match down into any descendant route trees since the router isn't aware of the descendant routes.</docs-warning> |
| 39 | + |
| 40 | +<docs-error>Do not do this</docs-error> |
| 41 | + |
| 42 | +<docs-info>The markup for this is kind of ugly, because (currently) these all have to be inside the `<docs-*>` element without any line breaks _but_ it is possible there could be an image inside these. <img src="https://picsum.photos/480/270" width="480" height="270" /></docs-info> |
| 43 | + |
| 44 | +Note: maybe the semantics for these aren't quite right. There might be other nouns that make sense in the case of docs, like: |
| 45 | + |
| 46 | +- `<docs-info>` could become `<docs-tip>` |
| 47 | +- `<docs-warning>` could become `<docs-important>` |
| 48 | +- `<docs-error>` could become `<docs-warning>` or `<docs-danger>` |
| 49 | + |
| 50 | +## Normal Prose |
| 51 | + |
| 52 | +@TODO Blockquotes, lists, etc. |
| 53 | + |
| 54 | +This is a `<blockquote>` with multiple lines in it: |
| 55 | + |
| 56 | +> This is my quote. |
| 57 | +> |
| 58 | +> It can have [links]($link), **bold text**, _italic text_, and even `<code>`, all of which should be accounted for. Oh, and don't forget lists: |
| 59 | +> |
| 60 | +> - List item 1 |
| 61 | +> - List item 2 |
| 62 | +> - List item 3 |
| 63 | +> |
| 64 | +> Unordered, or ordered: |
| 65 | +> |
| 66 | +> 1. List item |
| 67 | +> 2. Another list item |
| 68 | +> 3. Yet another list item |
| 69 | +
|
| 70 | +This is a list of links, some of which are code: |
| 71 | + |
| 72 | +- This is my first list item |
| 73 | +- [This is my second list item that’s a link][$link] |
| 74 | +- This is my third item that has `<code>` and [`<LinkedCode>` mixed with text][$link] |
| 75 | + |
| 76 | +And don't forget about proper styling for `<a>` tags that don’t have an `href`: <a>like this link right here</a>. |
| 77 | + |
| 78 | +## Code |
| 79 | + |
| 80 | +Normal code: |
| 81 | + |
| 82 | +```tsx |
| 83 | +<DataBrowserRouter initialEntries={["/events/123"]}> |
| 84 | + <Route path="/" element={<Root />} loader={rootLoader}> |
| 85 | + <Route |
| 86 | + path="events/:id" |
| 87 | + element={<Event />} |
| 88 | + loader={eventLoader} |
| 89 | + /> |
| 90 | + </Route> |
| 91 | +</DataBrowserRouter> |
| 92 | +``` |
| 93 | + |
| 94 | +With multiple highlighted lines: |
| 95 | + |
| 96 | +```tsx lines=[1-2,5] |
| 97 | +<DataBrowserRouter initialEntries={["/events/123"]}> |
| 98 | + <Route path="/" element={<Root />} loader={rootLoader}> |
| 99 | + <Route |
| 100 | + path="events/:id" |
| 101 | + element={<Event />} |
| 102 | + loader={eventLoader} |
| 103 | + /> |
| 104 | + </Route> |
| 105 | +</DataBrowserRouter> |
| 106 | +``` |
| 107 | + |
| 108 | +With a filename: |
| 109 | + |
| 110 | +```tsx filename=src/main.jsx |
| 111 | +<DataBrowserRouter initialEntries={["/events/123"]}> |
| 112 | + <Route path="/" element={<Root />} loader={rootLoader}> |
| 113 | + <Route |
| 114 | + path="events/:id" |
| 115 | + element={<Event />} |
| 116 | + loader={eventLoader} |
| 117 | + /> |
| 118 | + </Route> |
| 119 | +</DataBrowserRouter> |
| 120 | +``` |
| 121 | + |
| 122 | +Bad code with highlighted lines: |
| 123 | + |
| 124 | +```tsx bad lines=[2-5] |
| 125 | +<DataBrowserRouter initialEntries={["/events/123"]}> |
| 126 | + <Routes> |
| 127 | + <Route path="/" element={<Root />} loader={rootLoader}> |
| 128 | + <Route |
| 129 | + path="events/:id" |
| 130 | + element={<Event />} |
| 131 | + loader={eventLoader} |
| 132 | + /> |
| 133 | + </Route> |
| 134 | + </Routes> |
| 135 | +</DataBrowserRouter> |
| 136 | +``` |
| 137 | + |
| 138 | +Lines that overflow: |
| 139 | + |
| 140 | +```html |
| 141 | +<!-- Other HTML for your app goes here --> |
| 142 | +<!-- prettier-ignore --> |
| 143 | +<script src="https://unpkg.com/react@>=16.8/umd/react.development.js" crossorigin></script> |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +[$link]: https://www.youtube.com/watch?v=dQw4w9WgXcQ |
0 commit comments