test.mdx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. ---
  2. title: You don't vote for kings.
  3. description: Why do you think that she is a witch? How do you know she is a witch? Well, I didn't vote for you. Where'd you get the coconuts? Why? We shall say 'Ni' again to you, if you do not appease us.
  4. robots: noindex, nofollow
  5. ---
  6. I am your king. Well, I didn't vote for you. It's only a model. __…Are you suggesting that coconuts migrate?__ *Well, how'd you become king, then?* Well, how'd you become king, then?
  7. ```html example
  8. <span class="avatar" />
  9. ```
  10. ---
  11. ```html example code
  12. <span class="avatar" />
  13. ```
  14. ---
  15. ```html
  16. <span class="avatar" />
  17. ```
  18. SmartyPants can perform the following transformations:
  19. * Straight quotes ( " and ' ) into “curly” quote HTML entities
  20. * Backticks-style quotes (``like this'') into “curly” quote HTML entities
  21. * Dashes (“--” and “---”) into en- and em-dash entities
  22. * Three consecutive dots (“...”) into an ellipsis entity
  23. ## Found them? In Mercia?! The coconut's tropical!
  24. Well, she turned me into a newt. But you are dressed as one… It's only a model. Well, how'd you become king, then?
  25. 1. What do you mean?
  26. 2. Well, how'd you become king, then?
  27. 3. You can't expect to wield supreme power just 'cause some watery tart threw a sword at you!
  28. ### On second thoughts, let's not go there. It is a silly place.
  29. Why do you think that she is a witch? But you are dressed as one… Look, my liege! Now, look here, my good man. Bloody Peasant!
  30. * Where'd you get the coconuts?
  31. * Shut up! [Docs](/docs)
  32. * The swallow may fly south with the sun, and the house martin or the plover may seek warmer climes in winter, yet these are not strangers to our land.
  33. Shh! Knights, I bid you welcome to your new home. Let us ride to Camelot! But you are dressed as one… Well, I got better. The Lady of the Lake, her arm clad in the purest shimmering samite, held aloft Excalibur from the bosom of the water, signifying by divine providence that I, Arthur, was to carry Excalibur. That is why I am your king.
  34. ![Image description](https://images.unsplash.com/photo-1672244438282-aab5aae2bc2a?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1212&q=80)
  35. Bring her forward! Look, my liege! The swallow may fly south with the sun, and the house martin or the plover may seek warmer climes in winter, yet these are not strangers to our land. …Are you suggesting that coconuts migrate?
  36. What do you mean? Well, what do you want? It's only a model. Bloody Peasant!
  37. ## Example
  38. You don't frighten us, English pig-dogs! Go and boil your bottoms, sons of a silly person! I blow my nose at you, so-called Ah-thoor Keeng, you and all your silly English K-n-n-n-n-n-n-n-niggits! Look, my liege!
  39. Why? Shut up! Will you shut up?! Look, my liege! Listen. Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
  40. ## Table
  41. |sdfsdfsdf|Sdfsdfsdf|
  42. |-|-|
  43. |fghfghjfghj | sdfsdf |
  44. |dfghdfgh | Sdfsdfsdfsdf `sdfsd` sdfsdf|
  45. ## Code
  46. ```js
  47. function $initHighlight(block, flags) {
  48. try {
  49. if (block.className.search(/\bno\-highlight\b/) != -1)
  50. return processBlock(block, true, 0x0F) + ' class=""';
  51. } catch (e) {
  52. /* handle exception */
  53. }
  54. for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp
  55. if (checkCondition(classes[i]) === undefined)
  56. return /\d+/g;
  57. }
  58. }
  59. ```
  60. But you are dressed as one… Did you dress her up like this? Listen. Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony.
  61. ```css
  62. @media screen and (-webkit-min-device-pixel-ratio: 0) {
  63. body:first-of-type pre::after {
  64. content: 'highlight: ' attr(class);
  65. }
  66. }
  67. @import url('print.css');
  68. @page:right {
  69. margin: 1cm 2cm 1.3cm 4cm;
  70. }
  71. @font-face {
  72. font-family: Chunkfive; src: url('Chunkfive.otf');
  73. }
  74. div.text,
  75. #content,
  76. li[lang=ru] {
  77. font: Tahoma, Chunkfive, sans-serif;
  78. background: url('hatch.png') /* wtf? */; color: #F0F0F0 !important;
  79. width: 100%;
  80. }
  81. ```
  82. ## Test
  83. I have to push the pram a lot. You don't vote for kings. …Are you suggesting that coconuts migrate? And the hat. She's a witch! Be quiet!
  84. ## Test
  85. I'm not a witch. You don't vote for kings. On second thoughts, let's not go there. It is a silly place. You don't vote for kings. What do you mean?
  86. ## Test 1
  87. He hasn't got shit all over him. I don't want to talk to you no more, you empty-headed animal food trough water! I fart in your general direction! Your mother was a hamster and your father smelt of elderberries! Now leave before I am forced to taunt you a second time!
  88. The swallow may fly south with the sun, and the house martin or the plover may seek warmer climes in winter, yet these are not strangers to our land. We shall say 'Ni' again to you, if you do not appease us. [Gumroad](https://app.gumroad.com)
  89. Well, we did do the nose. Well, we did do the nose. Did you dress her up like this? You don't frighten us, English pig-dogs! Go and boil your bottoms, sons of a silly person! I blow my nose at you, so-called Ah-thoor Keeng, you and all your silly English K-n-n-n-n-n-n-n-niggits!
  90. ## Docs Theme
  91. Nextra Docs Theme is a theme that includes almost everything you need to build a modern documentation website. It includes a top navigation bar, a search bar, a pages sidebar, a TOC sidebar, and other built-in components.
  92. This website itself is built with the Nextra Docs Theme.
  93. ## Quick Start from Template
  94. ### Deploy to Vercel
  95. You can start by creating your own Nextra site and deploying to Vercel by clicking the link:
  96. [![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false)
  97. Vercel will fork the [Nextra Docs template](https://github.com/shuding/nextra-docs-template) and deploy the site for you. Once done, every commit in the repository will be deployed automatically.
  98. ### Fork the Template
  99. You can also manually fork the [template repository](https://github.com/shuding/nextra-docs-template).
  100. ## Start as New Project
  101. <div className="steps">
  102. ### Install
  103. To create a Nextra Docs site manually, you have to install **Next.js**, **React**, **Nextra**, and **Nextra Docs Theme**. In your project directory, run the following command to install the dependencies:
  104. {/* <Tabs items={['pnpm', 'npm', 'yarn']}>
  105. <Tab>
  106. ```bash
  107. pnpm i next react react-dom nextra nextra-theme-docs
  108. ```
  109. </Tab>
  110. <Tab>
  111. ```bash
  112. npm i next react react-dom nextra nextra-theme-docs
  113. ```
  114. </Tab>
  115. <Tab>
  116. ```bash
  117. yarn add next react react-dom nextra nextra-theme-docs
  118. ```
  119. </Tab>
  120. </Tabs> */}
  121. <Callout>
  122. If you already have Next.js installed in your project, you only need to install `nextra` and `nextra-theme-docs` as the add-ons.
  123. </Callout>
  124. ### Add Next.js Config
  125. Create the following `next.config.js` file in your project’s root directory:
  126. ```js filename="next.config.js"
  127. const withNextra = require('nextra')({
  128. theme: 'nextra-theme-docs',
  129. themeConfig: './theme.config.jsx',
  130. })
  131. module.exports = withNextra()
  132. // If you have other Next.js configurations, you can pass them as the parameter:
  133. // module.exports = withNextra({ /* other next.js config */ })
  134. ```
  135. With the above configuration, Nextra can handle Markdown files in your Next.js project, with the specified theme. Other Nextra configurations can be found in [Guide](/docs/guide).
  136. ### Create Docs Theme Config
  137. Lastly, create the corresponding `theme.config.jsx` file in your project’s root directory. This will be used to configure the Nextra Docs theme:
  138. ```jsx filename="theme.config.jsx"
  139. export default {
  140. logo: <span>My Nextra Documentation</span>,
  141. project: {
  142. link: 'https://github.com/shuding/nextra',
  143. },
  144. // ...
  145. }
  146. ```
  147. Full theme configurations can be found [here](/docs/docs-theme/theme-configuration).
  148. ### Ready to Go!
  149. Now, you can create your first MDX page as `pages/index.mdx`:
  150. ```mdx filename="pages/index.mdx"
  151. # Welcome to Nextra
  152. Hello, world!
  153. ```
  154. And run the `pnpm next` command to start developing the project! 🎉
  155. </div>
  156. Next, check out the next section to learn about organizing the documentation structure and configuring the website theme:
  157. ## What is Tabler?
  158. Tabler is a low-level, opinionated UI component library to build dashboards. It offers components, such as charts, layouts, or input elements, covering the essential parts of a dashboard or analytical interface. Our approach provides great flexibility between beautiful defaults and fast customization. The best way to get started is to check out our templates, called Blocks, for getting a feeling of how components are used and combined.
  159. <TablerSponsorsBanner />
  160. I’m not a witch. You don’t vote for kings. On second thoughts, let’s not go there. It is a silly place. You don’t vote for kings. What do you mean?
  161. ## Tips
  162. <TipGood>Good Tip</TipGood>
  163. <TipBad>Good Tip</TipBad>
  164. <TipChanges>Good Tip</TipChanges>
  165. ## Options
  166. <OptionsTable>
  167. <OptionTitle>
  168. ### `contentDirPath`
  169. (required)
  170. </OptionTitle>
  171. <OptionDescription>
  172. Path to where the content lives, relative to the root of your project.
  173. **Example:**
  174. ```js
  175. export default makeSource({
  176. contentDirPath: 'content',
  177. })
  178. ```
  179. This would load content from a `content` directory in your project.
  180. </OptionDescription>
  181. <OptionTitle>
  182. ### `contentDirInclude`
  183. </OptionTitle>
  184. <OptionDescription>
  185. An array of paths that Contentlayer should include, with the following conditions:
  186. - They can be either files or directories.
  187. - The paths need to be relative to `contentDirPath` or absolute.
  188. - An empty array means that all files in `contentDirPath` will be included.
  189. - Glob/wildcard patterns (e.g. using `*`) are not supported yet.
  190. This is useful when you have content spread across multiple directories in your project.
  191. **Default:** `[]`
  192. **Example:**
  193. This would target only content in the `docs` directory, while using the default for `contentDirExclude` (see below).
  194. ```js
  195. export default makeSource({
  196. // ...
  197. contentDirPath: '.',
  198. contentDirInclude: ['docs'],
  199. })
  200. ```
  201. </OptionDescription>
  202. <OptionTitle>
  203. ### `contentDirExclude`
  204. </OptionTitle>
  205. <OptionDescription>
  206. An array of paths that Contentlayer should explicitly exclude, with the following conditions:
  207. - **Setting this option completely overrides the defaults.**
  208. - They can be either files or directories.
  209. - The paths need to be relative to `contentDirPath` or absolute.
  210. - An empty array means that all files in `contentDirPath` will be included.
  211. - Glob/wildcard patterns (e.g. using `*`) are not supported yet.
  212. This is useful when you want to ignore a specific file or directory within your main content directory.
  213. **Default:** `['node_modules', '.git', '.yarn', '.cache', '.next', '.contentlayer', 'package.json', 'tsconfig.json']`
  214. **Example:**
  215. This ignores only the `content/internal-docs` directory, but targets all other content files in the `content` directory.
  216. ```js
  217. export default makeSource({
  218. // ...
  219. contentDirPath: './content',
  220. contentDirExclude: ['internal-docs'],
  221. })
  222. ```
  223. </OptionDescription>
  224. <OptionTitle>
  225. ### `documentTypes`
  226. (required)
  227. </OptionTitle>
  228. <OptionDescription>
  229. Your schema definitions for your project. See [`defineDocumentType`](/docs/reference/source-files/define-document-type) for usage.
  230. </OptionDescription>
  231. <OptionTitle>
  232. ### `markdown`
  233. </OptionTitle>
  234. <OptionDescription>
  235. Specify [remark](https://remark.js.org/) and [rehype](https://github.com/rehypejs/rehype) plugins.
  236. **Options:**
  237. - `remarkPlugins`
  238. - `rehypePlugins`
  239. **Example:**
  240. Here's an example that adds syntax highlighting with [highlight.js](https://highlightjs.org/usage/) (don't forget to add the css file somewhere e.g. from CDN).
  241. ```js
  242. import { makeSource } from '@contentlayer/source-files'
  243. import highlight from 'rehype-highlight'
  244. export default makeSource({
  245. // ...
  246. markdown: { rehypePlugins: [highlight] },
  247. })
  248. ```
  249. **Taking over the remark pipeline**
  250. [Under the hood](https://github.com/contentlayerdev/contentlayer/blob/2588c02e266289b8ef0a7ceccdeb804b045ad21a/packages/%40contentlayer/core/src/markdown/markdown.ts#L45), Contentlayer uses its own remark/rehype pipeline, and the plugins specified above are added after the preset plugins (for remark: `remarkFrontmatter`, `remarkParse`, and `remark2rehype`, and for rehype: `rehypeStringify`). However, if you need full control of the pipeline (e.g. [to add `allowDangerousHtml` to the `remark2rehype` plugin so that HTML is not stripped from markdown](https://github.com/contentlayerdev/contentlayer/issues/413), you can specify a function instead of an object:
  251. ```js
  252. export default makeSource({
  253. // ...
  254. markdown: (builder) => {
  255. builder.use(remarkFrontmatter)
  256. builder.use(remarkParse)
  257. // other remark plugins as you wish
  258. builder.use(remark2rehype, { allowDangerousHtml: true })
  259. // other rehype plugins as you wish
  260. // rehype to html
  261. builder.use(rehypeStringify)
  262. }
  263. })
  264. ```
  265. </OptionDescription>
  266. <OptionTitle>
  267. ### `mdx`
  268. </OptionTitle>
  269. <OptionDescription>
  270. Follows the same pattern as the `markdown` option, but for MDX processing.
  271. **Options:**
  272. - `remarkPlugins`
  273. - `rehypePlugins`
  274. **Example:**
  275. ```js
  276. import { makeSource } from '@contentlayer/source-files'
  277. import highlight from 'rehype-highlight'
  278. export default makeSource({
  279. // ...
  280. mdx: { rehypePlugins: [highlight] },
  281. })
  282. ```
  283. </OptionDescription>
  284. <OptionTitle>
  285. ### `fieldOptions`
  286. </OptionTitle>
  287. <OptionDescription>
  288. Provides the ability to manipulate how fields are written when parsing the content source.
  289. **Options:**
  290. - `bodyFieldName` (default: `body`): Name of the field containing the body/content extracted when the body type is `markdown` or `mdx`.
  291. - `typeFieldName` (default: `type`): Name of the field containing the name of the document type (or nested document type).
  292. **Example:**
  293. ```js
  294. export default makeSource({
  295. fieldOptions: {
  296. bodyFieldName: 'content',
  297. typeFieldName: '__typename',
  298. },
  299. })
  300. ```
  301. </OptionDescription>
  302. <OptionTitle>
  303. ### `date`
  304. </OptionTitle>
  305. <OptionDescription>
  306. Specify date options. Currently only supports:
  307. - `timezone`: Specify the timezone when parsing dates. Based on [@marsnusw/date-fns-tz](https://github.com/marnusw/date-fns-tz#zonedtimetoutc).
  308. </OptionDescription>
  309. </OptionsTable>