├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── contents ├── blog │ ├── first-blog.md │ └── second-blog.md └── docs │ └── template │ ├── get-started │ ├── MDX.mdx │ ├── introduction.md │ ├── latex.md │ └── syntax-highlighting.mdx │ ├── guide │ ├── anchor.mdx │ ├── contents.mdx │ ├── menu_items.mdx │ └── sidebar.mdx │ └── lorem-ipsum │ ├── Ipsum.md │ └── Lorem.md ├── gatsby-browser.js ├── gatsby-config.js ├── gatsby-node.js ├── gatsby ├── createPages.js ├── onCreateNode.js └── utils.js ├── package-lock.json ├── package.json ├── src ├── Header.tsx ├── Layout.tsx ├── PostCard.tsx ├── TableOfContents.tsx ├── images │ └── gatsby-icon.png ├── menuItems │ └── menuItems.json ├── pages │ ├── blog.tsx │ └── index.tsx ├── sidebar │ ├── index.tsx │ └── sidebar.json └── templates │ └── template.tsx ├── tsconfig.json └── types └── gatsby-mdx.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | # Project dependencies 2 | .cache 3 | node_modules 4 | yarn-error.log 5 | 6 | # Build directory 7 | /public 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ 3 | coverage/ 4 | build/ 5 | out/ 6 | public/ 7 | .cache/ 8 | **/aggregated-translations/*.* 9 | README.md 10 | build_output/ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jannik Buschke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | sample: https://www.jannikbuschke.de/gatsby-antd-docs/ 2 | 3 | # Gatsby Ant-Design Documentation Starter 4 | 5 | Forked from https://github.com/cvluca/gatsby-starter-markdown. 6 | 7 | This starter is boilerplate for (technical) documentation websites optionally accompanied by a blog (you can use it forever you want of course). 8 | 9 | # Getting started 10 | 11 | ```bash 12 | npm install gatsby -g 13 | gatsby new my-docs https://github.com/jannikbuschke/gatsby-antd-docs 14 | cd my-docs 15 | npm install 16 | npm run start 17 | ``` 18 | 19 | Visit `http://localhost:8000`. 20 | 21 | Edit files in `/content/docs` and see live updates. 22 | 23 | # Features 24 | 25 | - [x] Ant Design 26 | - [x] Typescript 27 | - [x] Markdown 28 | - [x] MDX 29 | - [x] Syntax highlighting 30 | - [x] Latex 31 | 32 | # Roadmap 33 | 34 | - [ ] Blog feature / second content type 35 | - [ ] Improved typings 36 | - [ ] Improved responsiveness 37 | - [ ] Add Search 38 | - [ ] svg intergration for excalidraw 39 | 40 | # Hosting 41 | 42 | In order to host the site the **sites path** needs to be put into gatsby-config.js export object on to the property _pathPrefix_. Then run 43 | 44 | ```bash 45 | npm run build 46 | ``` 47 | 48 | and copy the content of the public folder to the webspace. 49 | 50 | # License 51 | 52 | MIT 53 | -------------------------------------------------------------------------------- /contents/blog/first-blog.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: '2019-02-13' 3 | title: First Blog 4 | root: '/blog' 5 | --- 6 | 7 | # First Blog 8 | 9 | [Next Blog](/blog/second-blog) 10 | -------------------------------------------------------------------------------- /contents/blog/second-blog.md: -------------------------------------------------------------------------------- 1 | --- 2 | date: '2019-02-14' 3 | title: Second Blog 4 | root: '/blog' 5 | --- 6 | 7 | # Second Blog 8 | 9 | [Previous Blog](/blog/first-blog) 10 | -------------------------------------------------------------------------------- /contents/docs/template/get-started/MDX.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: MDX 3 | root: '/docs' 4 | parents: ['Get Started'] 5 | --- 6 | 7 | import { Input, Button } from 'antd' 8 | 9 | # A mix of Markdown, Frontmatter and JSX 10 | 11 |
12 | 13 |
14 | hello world 15 |
16 | 17 | 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /contents/docs/template/get-started/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

5 | Introduction 6 |

7 | 8 | # Gatsby Ant-Design Documentation Starter 9 | 10 | Forked from https://github.com/cvluca/gatsby-starter-markdown. 11 | 12 | This starter is boilerplate for (technical) documentation websites optionally accomponied by a blog (you can use it forever you want of course). 13 | 14 | # Getting started 15 | 16 | ``` 17 | npm install gatsby -g 18 | gatsby new my-docs https://github.com/jannikbuschke/gatsby-antd-docs 19 | cd my-docs 20 | npm run start 21 | ``` 22 | 23 | Visit http://localhost:8000. 24 | 25 | Edit files in `/content/docs` and see live updates. 26 | 27 | # Features 28 | 29 | - [x] Ant Design 30 | - [x] Typescript 31 | - [x] Markdown 32 | - [x] MDX 33 | - [x] Syntax highlighting 34 | 35 | # Roadmap 36 | 37 | - [x] Add typescript 38 | - [x] Remove Redux 39 | - [x] General simplifications 40 | - [x] Add mdx 41 | - [x] Add syntax highlighting with prismjs 42 | - [x] Improve Header UI 43 | - [ ] Fix menu item links not showing active state 44 | - [ ] Blog feature / second content type 45 | - [ ] Improved typings 46 | - [ ] Improved responsiveness 47 | - [ ] Add Search 48 | 49 | # Hosting 50 | 51 | In order to host the site the **sites path** needs to be put into gatsby-config.js export object on to the property _pathPrefix_. Then run 52 | 53 | ``` 54 | npm run build 55 | ``` 56 | 57 | and copy the content of the public folder to the webspace. 58 | 59 | # License 60 | 61 | MIT 62 | -------------------------------------------------------------------------------- /contents/docs/template/get-started/latex.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | # Latex Guide 5 | 6 | Included the `gatsby-remark-katex` plugin 7 | 8 | ## Examples 9 | 10 | Inline presentiation view: $a^2 + b^2 = c^2$ 11 | 12 | Display mode: 13 | 14 | $$ 15 | a^2 + b^2 = c^2 16 | $$ 17 | 18 | The default configuration is located at the `gatsby-config` file. For additional configurations with this plugin, check out the [official docs](https://www.gatsbyjs.org/packages/gatsby-remark-katex/) 19 | -------------------------------------------------------------------------------- /contents/docs/template/get-started/syntax-highlighting.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Syntax highlighting 3 | root: '/docs' 4 | parents: ['Get Started'] 5 | --- 6 | 7 | # Syntax highlighting 8 | 9 | ```javascript 10 | function() { 11 | return "Hello world"; 12 | } 13 | ``` 14 | 15 | ```jsx 16 |
17 | 18 | 19 | 20 |
21 | ``` 22 | -------------------------------------------------------------------------------- /contents/docs/template/guide/anchor.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

Anchor

5 | 6 | import { Alert } from 'antd' 7 | 8 | 9 | 10 | ## Introduction 11 | 12 | Anchor will automatically generate for your markdown pages based on headings. 13 | 14 | To create a heading, add one to six `#` symbols before your heading text. The number of `#` you use will determine the size of the heading. 15 | 16 | ```sh 17 | # The largest heading 18 | ## The second largest heading 19 | ###### The smallest heading 20 | ``` 21 | 22 | The anchor will be generated with different layers based on the size of the heading. 23 | 24 | ### Example 25 | 26 | Check the anchor on the right. 27 | 28 | #### The smaller heading 29 | -------------------------------------------------------------------------------- /contents/docs/template/guide/contents.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

Contents

5 | 6 | import { Alert } from 'antd' 7 | 8 | 9 | 10 | ## Source of contents 11 | 12 | All contents are stored under `/contents`. To change the root path, modify the following part in `gatsby-config.js`, simply by replace the `path` of it. 13 | 14 | ```sh 15 | { 16 | resolve: `gatsby-source-filesystem`, 17 | options: { 18 | name: `contents`, 19 | path: `${__dirname}/contents` 20 | } 21 | } 22 | ``` 23 | 24 | ## Information of the page 25 | 26 | We store the information of the page on the top of the markdown files used to generate sidebar, which currently includes the following infomation: 27 | 28 | - `title`: the title of the page 29 | - `date`: the date created 30 | - `root`: root of the pages should show in the sidebar (based on the path under `/contents`) 31 | - `parents`: parents of the page in the sidebar (the format show be `array`,top-down ordered). 32 | 33 | ### Example 34 | 35 | The current page have the following infomation on the top of the file: 36 | 37 | ```sh 38 | --- 39 | title: Contents 40 | root: "/docs" 41 | parents: ["Guide"] 42 | --- 43 | ``` 44 | 45 | The path of this file is `/contents/docs/guide/contents.md`. Since the root is `/docs`, all pages under this path will be showing in the sidebar. Some information is not used (i.e. date), so this file don't have it. 46 | 47 | ## Important to notice! 48 | 49 | The path of the pages will automatically generated based on the root folder. However, Gatsby will also automatically gererate pages under `/src/components/pages`, so you cannot have the markdown file with the same name under the root folder. 50 | -------------------------------------------------------------------------------- /contents/docs/template/guide/menu_items.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

Menu Items

5 | 6 | import { Alert } from 'antd' 7 | 8 | 9 | 10 | ## Introduction 11 | 12 | The menu items are showing on the top right of the website (currently have `Docs` and `Blog`). 13 | 14 | It is automatically generated base on `menuItems.json` file under the folder `/src/menuItems`, which contains name and link of the item. 15 | 16 | ### Example 17 | 18 | See the current file. `Docs` is linked directly to the markdwon page, and `Blog` is linked to a custom page under `/src/components/pages`. 19 | 20 | ```sh 21 | # /src/menuItems/menuItems.json 22 | [ 23 | { 24 | "name": "Docs", 25 | "link": "/docs/get-started/introduction" 26 | }, 27 | { 28 | "name": "Blog", 29 | "link": "/blog" 30 | } 31 | ] 32 | ``` 33 | -------------------------------------------------------------------------------- /contents/docs/template/guide/sidebar.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

Sidebar

5 | 6 | import { Alert } from 'antd' 7 | 8 | 9 | 10 | ## Introduction 11 | 12 | The sidebar is automatically generated with a given `root` from the current page, which the information are stored in the corresponding markdown file. It will show all the pages under the given `root`. By default, all items will be expanded. 13 | -------------------------------------------------------------------------------- /contents/docs/template/lorem-ipsum/Ipsum.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

5 | Quick Start 6 |

7 | 8 | # Armorum Aeneas notam locum 9 | 10 | https://jaspervdj.be/lorem-markdownum/ 11 | 12 | ## Oracula deus mons et nunc demittere exiguo 13 | 14 | Lorem _markdownum nunc_ medullas et vetat irae _lacrimae et reddant_ innumeris 15 | praeside, proles. Atra modo vulgata clade, descenderat quam Timores [iactato 16 | in](http://ipsemultum.net/mons-foresque) radiis quem? Solebam audisse nec illi 17 | hanc **neu** iam perque natus convulso Libycas, et iam. Cernens fidem vultus 18 | quod cognita conplexa causa, ensem, [nec](http://viros.io/et-senatus.html). 19 | 20 | - Occupat ille nutricis patria umbrosaque effugiam 21 | - Sonabat Saturnia caluere tantum iacebitis papilione Acrisius 22 | - Phoebe ab ab discrimine ulla consurgere aevi 23 | - Sollicitis Mycenae ipse 24 | 25 | Ductum menso aquis _disce_, si plura ut capacis vetat habet pollice? Exit 26 | adparentia voce cubitoque [laeva membrana](http://undis.net/) armentaque 27 | draconem amantem _vulnera_, me. Miser spes, quam curras ultima, **et unda**, 28 | quoque venturas. Saetas ut _micantes_ aera pressanda pelagi bellum parum erat 29 | carior? Aditus effusus auras, campos Chaos, quo _qui motisque_. 30 | 31 | ## Est aetas posuistis admovit capillos Temesesque satumque 32 | 33 | Hunc valuisse aliquid occiduus marmoreoque hamato tanta, cautibus et datur; 34 | hostilique! Est proceres numina noctis _et quod_. Eas via fundebat marisque 35 | fulgura Cupidinis longa patitur, sinum dabis? Tarda hastam ut illis, sunt non, 36 | festas necem ostendens copia. Femina faciendus visa. 37 | 38 | 1. Conrepta cum 39 | 2. Lunae hic est madidisque tempore Ino pugna 40 | 3. Fixa magico dixit a murmure furtim in 41 | 42 | Sibi multa, **est haec cum**, tangere Scythiae lumina, qui suo coniunxque populi 43 | ad Argus. Arma aequora, Acrota volant deos reperta ululatibus quoque, manus 44 | caelo. Torpor pumice, concavaque sed quo barbara ora infelix misera, ora forma, 45 | Crimisenque trahens hanc sumit? Adiuvat cecidit. Requiescit opes ego sanguinis 46 | tellurem colonos velle. 47 | 48 | ## Nec neve deos comitem 49 | 50 | Infitiatur et hoc [in concipit abest](http://tum.org/)! Fide adspicit laeta! Nam 51 | cur vidit hospes, alto est vesti mens luctibus litorei; tela mora tum. 52 | 53 | > Aureus sua vocem, armis, vero suas cacumen litore prius et nisi omni vel 54 | > rostro, **imago** obsequitur, vulnere! Occallescere pedes Pallantidos aequora 55 | > istis ut ingens furentem laborum aspergine facto Nyctimenen ad magni, quae 56 | > **tua**. Velante **per** color Rhodopeius zonam nec nitentia caelum creati 57 | > nunc _hanc_ aliorum: propensum mirandum vel membra caedis, esse. Dum crimine 58 | > dira latices. 59 | 60 | Ithaceque Rhesi nubilibus quoque caecisque enim, hoc trepidant numina fulminis 61 | auras curvavit. In quem Iuno est, nam meis coniunx regna _concurrere_ praestat 62 | temptare! 63 | 64 | # Hoc sentit lapides nuruumque litora est 65 | 66 | ## Dextris rudis perlucida patriam et quique coepto 67 | 68 | Lorem markdownum Tmolo natarum, in metuens natus altis totis lacrimarum, litore. 69 | Fama spinae venenis mariti at et parcere adveniens, anticipata, exitio sumpta, 70 | dearum trado! Referre quinquennem intus cecidere adapertaque leto protulit sine, 71 | temeraria fretum tubicen, iuvencae fuit, aurae. Illo aestuat. 72 | 73 | - Hunc tibi cute lingua tegi inplet venenis 74 | - Saltibus capillos formosus 75 | - Ac illac agmina exturbare Saturnia delata 76 | - Nil ut 77 | 78 | ## Fundit pro cervix occulta floribus 79 | 80 | Istis quam nec, cava! Palmis fugit conata erat nam profuga incana. Nec heres 81 | _quod soror_ Styga vinci referitur spretor tamen: quisquam [metiris vagantes 82 | vestis](http://www.prolemfine.io/) ars aguntur illa sic. Gentis secum pedibus 83 | esse ipse tot: inquit conorque hunc ex tollens dixit, sic comitata ipse esset 84 | cum. 85 | 86 | - Metu nardi relatus 87 | - In tenui 88 | - Moras levis intra quidem 89 | - Eligit ceu aures Neptunus feres 90 | - Trepidantia vocat 91 | - Corpus vitamque quos 92 | 93 | ## Haustus ore 94 | 95 | Vel et, saxa fumos utraque, alto **per perfudit quondam** facta! Notam harenam 96 | tibi. Sollicitive secuta illa **Danaas et fumos**. 97 | 98 | 1. Quae terras illa cibos ille quam 99 | 2. Altius balatus sonti durior pennas insilit micantia 100 | 3. Ille inmunemque nec crescere hoc notis hinc 101 | 4. Et non 102 | 103 | Infelix superis _sub inritamina recens_ et gratia recordor, primus et Lycus, 104 | omnia venientesque evitata. Leonem columque induit. Pictis tempore conbibit tam 105 | ratione: _Tartareas_ iungitur ultime morata polis coniugiumne umbra deposuit 106 | coronis. Zonarumque habere da fronde quodsi cum venerisque vertitur atque; 107 | exigit nosse. Adventum [grates](http://manente.org/pater): requirit seminaque 108 | ullis in odit _plagis resecare_ quoque manusque et **quamvis traxit** horruerant 109 | partes; in. 110 | 111 | # Libratus nostri perierunt Ithaco casside pedibusque expendite 112 | 113 | ## Viscera habetque 114 | 115 | Lorem markdownum fratribus. Laesa vero columque capit: sui ut di digitos 116 | caluere, mihi [ubi dederat](http://www.sic-memoris.org/nullapontus). Tuam illo; 117 | sed Ligdum rapidi; parvos trahar labori crines in Marsque sparsi exterrita in. 118 | 119 | - Posse oblectamina distamus adspice ira unus erat 120 | - Quibus instabilesque ortas unam 121 | - Aversum stimuletur quem 122 | 123 | ## Suis quod tori silvamque os dixit 124 | 125 | Confessus recentes trepidi sustulit vipereas denique mento, iuveni. Vulgus est 126 | excedit, et dixisse desint invenerit pocula, imo vitta. 127 | 128 | - Eademque ambo 129 | - Mater usum 130 | - Vehi pars tridentigero terga unius Iuppiter tinnitibus 131 | - Amantem antra secundis ignisque 132 | - In iube 133 | - Vix vincula intereat fissaque simul suppressit 134 | 135 | ## Quod arva maligno in mugitu et crinis 136 | 137 | Illi vivere dic talaria secedere Anguem, pennas. Phoebeius teneat, vertit mella, 138 | tibi oraque Assaracus. _Animos_ tumor sunt ferarum _Cythereiadasque trahatur_ 139 | Hippotaden alios relicta o quamvis undis, ambo aetheriae bellare apertum laesit, 140 | Avernas. Cum unda _Peragit_ urbis oscula cumque _et_ pietas redeat: [longa 141 | senis](http://www.numerisnymphae.io/) gramine, circumlita sit Pentheus accepto 142 | postquam. Non signa Troiana [Erecthida](http://www.cum.com/coniuge) addicere 143 | fratres conplectitur terras in manu oris Pallas caro cum, dei ut tempora! 144 | 145 | - Armenta forma sensit ille quidem arbore vincula 146 | - Usus ipse spreta 147 | - Sunt non 148 | - Adoratis est parte primae raptaturque carpis 149 | 150 | ## Niveo sua in corporis dumque exul uterque 151 | 152 | Pondere thalamo, cristis? Sub _nescia_ Saturnia occupat premit Acheloides, 153 | laesit hoc Turne vel, annua tamen hanc, tu. Adnuit sic culpavi certe; ira esse 154 | Ithaco [pennis abit](http://sincerumque.net/caduntpromittis.aspx) prosilit 155 | quinque. Est amnesque removit detinuit ad turbarat [cara cecidere 156 | pariter](http://www.est.org/). 157 | 158 | 1. Loqui dignos cum tot gratentur 159 | 2. Laudata solent illi 160 | 3. In lenius fuerat 161 | 4. Non collo igitur capiat iamque 162 | 5. Caput placidos arbore do nec non haec 163 | 6. Statque dabitur gratamque vocat viribus nomine 164 | 165 | Amo meris; hiatus qui ille o erat, Euphrates ad loco Iolen; intellegat! Sim 166 | cruori concolor vestigia, verbis intrarunt. 167 | -------------------------------------------------------------------------------- /contents/docs/template/lorem-ipsum/Lorem.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 |

5 | Overview 6 |

7 | 8 | # Sub illa obnoxia 9 | 10 | https://jaspervdj.be/lorem-markdownum/ 11 | 12 | ## Hoc Tirynthius trepidos 13 | 14 | Lorem markdownum senioribus fugae. Pastorve pectora defossos. Praestent mittere. 15 | Pericli ferebat urbis est longe traderet quid verborum, o et fraterna. 16 | 17 | ## In auctor 18 | 19 | Qui cadat naturale moderantum nervoque _currendo arva_ qui. Bisaltida robore, 20 | dona obscura, atque, tam sperni somnia diu! Vetus cautus sustinet aequatam _quae 21 | luminis_ nitidissima cinctaque qui tutus adunco aut balteus, tam addit et 22 | _arcana_! Corde Iuppiter pronus duas pondus, tantique duas, Fluctibus duraeque. 23 | 24 | > Surgunt videre. Nec fortis ambo Seriphon. Ismariis fuit quod quamquam **tersis 25 | > virginis**, instrumenta; ubi arte, erat audito vulgarunt taurum amplexas 26 | > digiti. Virbius me illa surgit qui vocatum primus haec medullas; se dare 27 | > momentaque oculos, aquae, ipsum intrat. 28 | 29 | ## Fertque et portabat hausitque eadem terram eundem 30 | 31 | Das optat, silet suo harundine secedit, unum, labefactum. Sic non fiducia 32 | Hippason iuris, mens [ante pudorem](http://www.dilectos.com/mihi-hoc.html) par 33 | perfida spirantis **coniuge** huc. Viridique ut male. 34 | 35 | > Cum et insignis mea. Carebat fluctibus novissima iter foventque grave 36 | > **populusque** gradus fata somnus fuerat, amne carina totidem ut et tanta 37 | > aethera. Tantus et femineos tactis relinquar, non iam hos, dum adest? 38 | 39 | ## Aiax quem saevum excussit addita 40 | 41 | Haberent quot, conde perfudit ligno arce _tinctam_, tota caede, et sit. Excipit 42 | et quem torrem, posses [idonea super](http://dum.com/erroremruent.aspx) satumque 43 | patiens verba nomen amisere respicit! Votoque nam ista ipse conluerant et finis. 44 | Sunt caput est, Telamonque numquam atavosque facta sollertius haeserat templorum 45 | potentia. 46 | 47 | Dolorque frustra, et suae [missum ad vestigia](http://olenos.com/) ipsos 48 | falleret: praeponere crimine qui. Nemo despicit vagans, miserarum stabit tantum 49 | seque transitus celebri verba liber. Gramen crescunt dixit et gerit ferunt. 50 | Esset esse minimo illa Melicerta, factum, cum verbis vicem armentis: cubilia. 51 | 52 | # In e utque est petis moventem nostras 53 | 54 | ## Ego deae longos ipse 55 | 56 | Lorem markdownum puppe in dumque potuit letalibus _nobis et et_ saxo inlaesos et 57 | manent aliquid clipeus, via artus? Monstri fidere pes debere horum domi habet, 58 | ex Achilles vultus exterrita genitor modo. Et ponat erat equorum factis populo, 59 | haec mille tamen auctorem alta sanguine, sed! 60 | 61 | 1. Mihi succumbere luctuque inguine Saturnius luce 62 | 2. Coniuge nec euhoe ait iamque Titania sensura 63 | 3. Quia agendo 64 | 4. Vestem cui mediis saecula animum vulneribus talibus 65 | 66 | Super hoc, est si nisi, captare venit. Modo quae nervis voce _naiadum_ gratus. 67 | Quod eluvie, tua lues Iovis paludosa. Et Somni fletumque imagine sanguinis 68 | lacrimis tepido, si arva opto. Orbe animo videoque viscera maestissimus utilius 69 | oris, fine relapsa; oscula, quod dixi aquae; traduxit sequitur. 70 | 71 | ## Adhaesi Cythereius 72 | 73 | Hectoreis nec pone **et exigui repurgato** fictum caelo despicitur ignis anguis 74 | et, os tela cornua capillos, per aequum. _Diversa cessere_: fugientia, inquam 75 | prementem illo. Meo deditque, undis linguae occurret angustis terris; forte! 76 | Magis causa misit nec. Iuveni Indigetes quam nec flumen nobilitate _splendidus 77 | venisse_, subito et ad clauduntur solis: diligitur. 78 | 79 | - Paludibus cava 80 | - Mille vino oppressumque clade altis tendere maligno 81 | - Et signatum regia ducem 82 | - Sacrata et dant accipitrem donec Eurylochum date 83 | - Adspexisse aliter ministros petito 84 | 85 | Est concipit Phoronide mihi illa quaesierat omnis parentem et pectus damna 86 | verbis **fugio** faticinasque, ut? Iphis care ad Minyis dixit? 87 | 88 | 1. Ante tum 89 | 2. Refert optima cortinaque tria tunicasque meritorum Romana 90 | 3. Et adunca docebo prospicit alti nisi ulla 91 | 92 | Lascivaque Error regem ut **aequore hanc**, ceu quanta habet quas Caeni. 93 | Rubefacta sterilem trahebat talia Caeneus possemque putet corpore conscelero 94 | nubes. Cinyran ab ira suco iactantur septem frui barba Maenalon _ante Caeneus_: 95 | sed nos adicit amores tellus. 96 | 97 | # Temperius tenebo regia hoc 98 | 99 | ## Vel et oris cernimus iungit 100 | 101 | Lorem markdownum erat animos. Imitata ante quoniam? 102 | 103 | 1. Iste aevo non adspexisse quod in est 104 | 2. Vulnere cavatur 105 | 3. In fallax Corycidas adscendit et venite miserae 106 | 4. Inludens clipeum 107 | 108 | Eheu sibilat est omnia dederat, idcirco magnum, _respiramina punica_: at hostis. 109 | In nepotemque et sunt mentes, me inque haerentem pendere concretum et remis 110 | numina; est. Ulixes sulcat danda ad mitior eritque, questi iurare et patris, 111 | tempore sit! 112 | 113 | Et ille in spes et quae conferre; pars inpia Cinyras tractata visent stetimus 114 | meum magno spectabilis repleri. Herbis collo ductor alimenta, siquid capit 115 | repugnat. Loqui tamen, signant traiectus se causa. Nec aegida conposito iniqua. 116 | 117 | ## Perque praesentia 118 | 119 | Ait mediaque, esse diuturnior vocat non captivarumque late quaterque relatis 120 | flumina. Vicit et _coniugis caede_ corpus Palameden timuere a domus quo 121 | Phrygiae, de, quod. Mihi socios **rapuere**! 122 | 123 | Et esset: atrae nymphae maior passa dixit pomum vipereis pugnae. Et coniugis, 124 | [dixere qua exuit](http://longum.net/), votorum animam corpus dixerat et genus. 125 | **Ut** ingentia agnovere dixere cognovi, dixit et valens et vultus felicem 126 | abstractus: deorum: nefas quod et. 127 | 128 | 1. Aetne est gloria cumque 129 | 2. Idem ire 130 | 3. Mens ferventibus frustra lapidosas aranea mentisque sinistro 131 | 4. Thybridis et cornua 132 | 5. Vibrantia aequora 133 | 6. Paridis collecta comites purpureasque gente 134 | 135 | Tantae Neptunius _utque refluum antiquarum_ parat vitae paternum bracchia 136 | iuvenale fortunata nec genitor videtur, cur. Locumque caputque et quodam, haud 137 | nomen urbis. Mortalia nomina anili tamen vocant quae iamque platanus cedentes 138 | nec novo manet tristia sidera maduerunt duabus fallaciter excussum hi. [Umidus 139 | aqua ultima](http://dorylas-quis.org/nimisilla.html) sagittis se primo accipit: 140 | cecidere flammas violaverat annos et caesaries. 141 | 142 | Non graviore numerare tenuere Propoetidas versum audito laborem amor arbor 143 | quisquis nullus _iunxit_, est! Cursu metu margine minimo sequentes habet 144 | honorem; forma verso. Liquitur praeceps, _quantus ex_ natalis, vidi cedere per 145 | moror cur hoc et ipse **erat gaude**, qua. 146 | 147 | # Quae Rhadamanthus facta populus et 148 | 149 | ## Novus cremarat arcanaque rogaberis certe 150 | 151 | Lorem markdownum durum Amphitryoniadae viriles. Parenti et pars Pana; Idmoniae 152 | usus. Pater Troezenius comitata _et erat isset_ aestuat. 153 | 154 | 1. Nimbis ne virginis cutem 155 | 2. Est ora attrahitur ob defunctum esset 156 | 3. Quidem rediit Herse moderator despectat miserere 157 | 4. Et ille ferro veterum artesque dictis 158 | 159 | ## Illam mille et colores abluere quoque celerique 160 | 161 | Manus indicat priscis vade; at vocabis daret caelo, metus levi. Ego sine 162 | volitare, per membra tibi, et Europam aquis vineta vidi procul magis dare ibat 163 | tecta. Suspirat in pater in fecit. In levatus dicitur. Athenae meta, iugalia, 164 | valeat lacerto: Ithaceque vaporibus oscula corripiunt falce. 165 | 166 | Mulcere dea viriles erat rapta nece veste imagine virginis nec. Producet origine 167 | luctus posita nostri; rex petunt praebuit tanta _est novos_. [Incidis quaesitis 168 | putet](http://ubi.io/) et sono fertur inter pependit vomentes donec. 169 | 170 | ## Querellae tegebat 171 | 172 | Violasse mea deum equorum cruorem purasque Palladias quid cum unus primusque 173 | longo Tartara **incepto** factorum maenala Bacchum cognita vixque sunt. Fingant 174 | natis, ergo voco credere pedem Philomela num rubor, campis pudorem, quid facerem 175 | [suis](http://flaminaat.com/surgit). Bromumque locus intrasse: vocibus _fera 176 | animoque_, se quam molior vinclo. Unda aquas, dixit non: quo aut cum relinquit, 177 | altissimus sub, _sonat_. Linguae cuncta, iam meorum in, in _pro_ patulosque. 178 | 179 | ## Aliquidque comitesque Dircen ferunt aquarum iubet offert 180 | 181 | Ore equo _Helenum_; cum premit crines. Non **amor** sibi voti tamen ne **impetus 182 | conspexit** equique? 183 | 184 | ## Haec illuc nunc tellus 185 | 186 | Conclamat nimiumque rigidis sparsit mihique esse territa tibi mactare loquax 187 | alis capaci domo, deum velut quibus _parenti_. Depulsum cum sic tristes iuvenes 188 | Cydoneasque ferro ad periit, in. Tum somnos cadunt. 189 | 190 | > Patria rursus per meae _mugitus_, cor tectis hunc pretioque alios cum incerta 191 | > Phoeboque enim Dryope, erat aspergine. Et lingua virgo aliquo facis et amor 192 | > pietas lex aptamque tento, dea vult. E [stringebat 193 | > illa](http://rupisque.com/); est quae elice camini. Inpulit salutet natam 194 | > addit passos, est speciosoque invidere festo frigidus in manu, et 195 | > inpedientibus. Ventris _vulgusque_ cum illam delusa exsul, voveo avidam tam 196 | > **sacrilega** labi iterum undique victum ignorant in vias lacrimabile. 197 | 198 | Classe et pro torvamque Tempe! Succidere [pendenti 199 | vixque](http://www.modumque-saevitiam.net/adiciunt.html), hoc vates et conplet 200 | relatu cruentos quod fertque cumba quod discrimen. _Populator potentia in_ 201 | structa ut decor sororum traiecit igitur. Nec rigore protinus, plangor clamat. 202 | -------------------------------------------------------------------------------- /gatsby-browser.js: -------------------------------------------------------------------------------- 1 | // gatsby-browser.js 2 | require('prismjs/themes/prism-coy.css') 3 | require('antd/dist/antd.css') 4 | require(`katex/dist/katex.min.css`) 5 | -------------------------------------------------------------------------------- /gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteMetadata: { 3 | title: 'Gatsby Ant-Design Documentation Starter', 4 | }, 5 | plugins: [ 6 | `gatsby-plugin-typescript`, 7 | `gatsby-plugin-react-helmet`, 8 | { 9 | resolve: `gatsby-source-filesystem`, 10 | options: { 11 | name: `images`, 12 | path: `${__dirname}/src/images`, 13 | }, 14 | }, 15 | `gatsby-transformer-json`, 16 | { 17 | resolve: `gatsby-source-filesystem`, 18 | options: { 19 | name: `menuItems`, 20 | path: `${__dirname}/src/menuItems`, 21 | }, 22 | }, 23 | { 24 | resolve: `gatsby-source-filesystem`, 25 | options: { 26 | name: `sidebar`, 27 | path: `${__dirname}/src/sidebar`, 28 | }, 29 | }, 30 | { 31 | resolve: `gatsby-source-filesystem`, 32 | options: { 33 | name: `contents`, 34 | path: `${__dirname}/contents`, 35 | }, 36 | }, 37 | `gatsby-plugin-image`, 38 | `gatsby-transformer-sharp`, 39 | `gatsby-plugin-sharp`, 40 | { 41 | resolve: `gatsby-plugin-manifest`, 42 | options: { 43 | name: 'gatsby-starter-markdown', 44 | short_name: 'starter', 45 | start_url: '/', 46 | background_color: '#663399', 47 | theme_color: '#663399', 48 | display: 'minimal-ui', 49 | icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site. 50 | }, 51 | }, 52 | { 53 | resolve: `gatsby-transformer-remark`, 54 | options: { 55 | plugins: [`gatsby-remark-images`], 56 | }, 57 | }, 58 | { 59 | resolve: `gatsby-plugin-mdx`, 60 | options: { 61 | defaultLayouts: { 62 | default: require.resolve('./src/Layout.tsx'), 63 | }, 64 | extensions: ['.mdx', '.md'], 65 | // workaround: https://github.com/gatsbyjs/gatsby/issues/16422#issuecomment-518985316 66 | plugins: [`gatsby-remark-autolink-headers`], 67 | gatsbyRemarkPlugins: [ 68 | `gatsby-remark-katex`, 69 | { 70 | resolve: `gatsby-remark-images`, 71 | options: { 72 | maxWidth: 1035, 73 | }, 74 | }, 75 | `gatsby-remark-autolink-headers`, 76 | { 77 | resolve: `gatsby-remark-prismjs`, 78 | options: { 79 | classPrefix: 'language-', 80 | inlineCodeMarker: null, 81 | showLineNumbers: true, 82 | noInlineHighlight: false, 83 | }, 84 | }, 85 | ], 86 | }, 87 | }, 88 | `gatsby-plugin-remove-trailing-slashes`, 89 | // this (optional) plugin enables Progressive Web App + Offline functionality 90 | // To learn more, visit: https://gatsby.app/offline 91 | // 'gatsby-plugin-offline', 92 | ], 93 | /// this must match the path your webpage is displayed from (the second part of the ternary will be the path prefix for production) 94 | pathPrefix: process.env.NODE_ENV === 'development' ? '' : '', 95 | } 96 | -------------------------------------------------------------------------------- /gatsby-node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Node APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.org/docs/node-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | 9 | module.exports = { 10 | createPages: require('./gatsby/createPages'), 11 | onCreateNode: require('./gatsby/onCreateNode'), 12 | } 13 | -------------------------------------------------------------------------------- /gatsby/createPages.js: -------------------------------------------------------------------------------- 1 | const replacePath = require('./utils') 2 | const path = require('path') 3 | 4 | module.exports = exports.createPages = ({ actions, graphql }) => { 5 | const { createPage } = actions 6 | 7 | const Template = path.resolve(`src/templates/template.tsx`) 8 | 9 | // sort: { order: DESC, fields: [frontmatter___date] }, limit: 1000 10 | return graphql(` 11 | { 12 | allMdx { 13 | edges { 14 | node { 15 | id 16 | fields { 17 | slug 18 | } 19 | } 20 | } 21 | } 22 | } 23 | `).then(result => { 24 | if (result.errors) { 25 | return Promise.reject(result.errors) 26 | } 27 | result.data.allMdx.edges.forEach(({ node }) => { 28 | createPage({ 29 | path: replacePath(node.fields.slug), 30 | component: Template, 31 | context: { id: node.id }, // additional data can be passed via context 32 | }) 33 | }) 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /gatsby/onCreateNode.js: -------------------------------------------------------------------------------- 1 | const replacePath = require('./utils') 2 | const { createFilePath } = require(`gatsby-source-filesystem`) 3 | 4 | module.exports = exports.onCreateNode = ({ node, getNode, actions }) => { 5 | const { createNodeField } = actions 6 | if (node.internal.type === `MarkdownRemark`) { 7 | const slug = createFilePath({ node, getNode, basePath: `pages` }) 8 | createNodeField({ 9 | node, 10 | name: `slug`, 11 | value: replacePath(slug), 12 | }) 13 | } else if (node.internal.type === 'Mdx') { 14 | const value = createFilePath({ node, getNode }) 15 | createNodeField({ 16 | // Name of the field you are adding 17 | name: 'slug', 18 | // Individual MDX node 19 | node, 20 | // Generated value based on filepath with "blog" prefix 21 | // value: `/blog${value}`, 22 | value: replacePath(value), 23 | }) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /gatsby/utils.js: -------------------------------------------------------------------------------- 1 | // Replacing '/' would result in empty string which is invalid 2 | module.exports = replacePath = path => 3 | path === `/` ? path : path.replace(/\/$/, ``) 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-antd-docs", 3 | "description": "Gatsby Antd Docs Starter", 4 | "version": "0.4.0", 5 | "author": "Jannik Buschke", 6 | "dependencies": { 7 | "@mdx-js/mdx": "1.6.22", 8 | "@mdx-js/react": "1.6.22", 9 | "@mdx-js/tag": "0.20.3", 10 | "antd": "4.16.8", 11 | "esbuild": "0.13.8", 12 | "gatsby": "^4.0.0", 13 | "gatsby-cli": "^4.0.0", 14 | "gatsby-plugin-image": "^2.0.0", 15 | "gatsby-plugin-manifest": "^4.0.0", 16 | "gatsby-plugin-mdx": "^3.0.0", 17 | "gatsby-plugin-offline": "^5.0.0", 18 | "gatsby-plugin-react-helmet": "^5.0.0", 19 | "gatsby-plugin-sharp": "^4.0.0", 20 | "gatsby-plugin-typescript": "^4.0.0", 21 | "gatsby-remark-autolink-headers": "^5.0.0", 22 | "gatsby-remark-images": "^6.0.0", 23 | "gatsby-remark-katex": "^6.0.0", 24 | "gatsby-remark-prismjs": "^6.0.0", 25 | "gatsby-source-filesystem": "^4.0.0", 26 | "gatsby-transformer-json": "^4.0.0", 27 | "gatsby-transformer-remark": "^5.0.0", 28 | "gatsby-transformer-sharp": "^4.0.0", 29 | "katex": "0.13.18", 30 | "prismjs": "1.25.0", 31 | "react": "17.0.2", 32 | "react-dom": "17.0.2", 33 | "react-helmet": "6.1.0", 34 | "react-responsive": "8.2.0", 35 | "react-sizeme": "3.0.1" 36 | }, 37 | "keywords": [ 38 | "gatsby" 39 | ], 40 | "browserslist": [ 41 | ">0.2%", 42 | "not dead", 43 | "not op_mini all", 44 | "last 1 chrome version", 45 | "last 1 firefox version", 46 | "last 1 safari version" 47 | ], 48 | "license": "MIT", 49 | "scripts": { 50 | "build": "gatsby build --prefix-paths", 51 | "develop": "gatsby develop", 52 | "serve": "gatsby serve", 53 | "start": "npm run develop", 54 | "format": "prettier --write \"./**/*.[jt]s?(x)\" \"./**/*.md\" \"./**/*.json\"", 55 | "test": "echo \"Error: no test specified\" && exit 1", 56 | "deploy": "gatsby build --prefix-paths && gh-pages -d public", 57 | "clean": "gatsby clean" 58 | }, 59 | "devDependencies": { 60 | "@types/node": "^16.4.2", 61 | "@types/react": "17.0.15", 62 | "@types/react-dom": "17.0.9", 63 | "@types/react-helmet": "6.1.2", 64 | "gatsby-plugin-remove-trailing-slashes": "3.10.0", 65 | "gh-pages": "^3.2.3", 66 | "prettier": "2.3.2" 67 | }, 68 | "repository": { 69 | "type": "git", 70 | "url": "https://github.com/jannikbuschke/gatsby-antd-docs" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Header.tsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | import { Link } from 'gatsby' 3 | import { Button, Menu, Row } from 'antd' 4 | import { GithubOutlined, TwitterOutlined } from '@ant-design/icons' 5 | 6 | interface Props { 7 | siteTitle: string 8 | } 9 | 10 | export class Header extends Component { 11 | render() { 12 | const { siteTitle } = this.props 13 | return ( 14 | 15 | 16 | 17 | 18 | {siteTitle} 19 | 20 | 21 | }> 22 | 26 | GitHub 27 | 28 | 29 | }> 30 | 31 | Twitter 32 | 33 | 34 | 35 | 36 | ) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Layout.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import Helmet from 'react-helmet' 3 | import { StaticQuery, graphql } from 'gatsby' 4 | import { Header } from './Header' 5 | import { pathPrefix } from '../gatsby-config' 6 | import { Layout } from 'antd' 7 | import { Sidebar } from './sidebar' 8 | import { TableOfContents } from './TableOfContents' 9 | 10 | const { Sider, Content } = Layout 11 | 12 | export function RootLayout({ children }: React.PropsWithChildren<{}>) { 13 | return ( 14 | { 34 | const allPosts = data.allMdx.edges.map( 35 | (edge: any) => edge.node.fields.slug 36 | ) 37 | let onPostPage 38 | if (typeof window !== 'undefined') { 39 | const path = window.location.pathname.replace( 40 | pathPrefix.slice(0, -1), 41 | '' 42 | ) 43 | if ( 44 | allPosts.indexOf(path) >= 0 || 45 | allPosts.indexOf(path.slice(0, -1)) >= 0 46 | ) { 47 | onPostPage = true 48 | } else { 49 | onPostPage = false 50 | } 51 | } 52 | 53 | const { title } = data.site.siteMetadata 54 | 55 | return ( 56 |
57 | 64 | 65 | 66 |
67 | 68 |
75 | 76 | 77 | 84 | {children} 85 | 86 | 87 | 88 |
89 | 90 | 94 | 95 |
96 | ) 97 | }} 98 | /> 99 | ) 100 | } 101 | 102 | export default RootLayout 103 | -------------------------------------------------------------------------------- /src/PostCard.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { Link } from 'gatsby' 3 | import Card from 'antd/lib/card' 4 | import 'antd/lib/card/style/css' 5 | 6 | export const PostCard = ({ post }) => ( 7 |
8 | 11 | 15 | {post.frontmatter.title} 16 | 17 | 23 | {post.frontmatter.date} 24 | 25 |
26 | } 27 | > 28 | {post.excerpt} 29 | 30 |
31 | 32 | ) 33 | -------------------------------------------------------------------------------- /src/TableOfContents.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import Anchor from 'antd/lib/anchor' 3 | import 'antd/lib/anchor/style/css' 4 | 5 | const { Link } = Anchor 6 | 7 | const filterAnchorDetails = (anchors) => { 8 | let last_depth = 0 9 | anchors = [].slice.call(anchors).map((anchor) => { 10 | let depth = parseInt(anchor.parentElement.nodeName[1]) 11 | if (last_depth !== 0 && depth > last_depth) depth = last_depth + 1 12 | last_depth = depth 13 | return { 14 | href: '#' + anchor.parentElement.id, 15 | title: anchor.parentElement.innerText, 16 | depth: depth, 17 | children: [], 18 | } 19 | }) 20 | constructTree(anchors) 21 | return anchors 22 | } 23 | 24 | const constructTree = (list) => { 25 | let deleteNode = [] 26 | for (let i = 0; i < list.length; i++) { 27 | for (let j = i + 1; j < list.length; j++) { 28 | if (list[i].depth + 1 === list[j].depth) { 29 | list[i].children.push(list[j]) 30 | deleteNode.push(j) 31 | } else if (list[i].depth >= list[j].depth) break 32 | } 33 | } 34 | deleteNode.sort((a, b) => b - a).forEach((index) => list.splice(index, 1)) 35 | } 36 | 37 | export function TableOfContents() { 38 | const [anchors, setAnchors] = React.useState([]) 39 | 40 | React.useLayoutEffect(() => { 41 | const anchors = document.getElementsByClassName('post-toc-anchor') 42 | setAnchors(filterAnchorDetails(anchors)) 43 | }, []) 44 | 45 | const loop = (data) => 46 | data.map((item) => { 47 | if (item.children.length > 0) { 48 | return ( 49 | 50 | {loop(item.children)} 51 | 52 | ) 53 | } 54 | return 55 | }) 56 | return ( 57 | {loop(anchors)} 58 | ) 59 | } 60 | -------------------------------------------------------------------------------- /src/images/gatsby-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jannikbuschke/gatsby-antd-docs/5bab36ebb685181eb82ed38c6d177117c9a091e2/src/images/gatsby-icon.png -------------------------------------------------------------------------------- /src/menuItems/menuItems.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Docs", 4 | "link": "/docs/get-started/introduction" 5 | }, 6 | { 7 | "name": "Blog", 8 | "link": "/blog/first-blog" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /src/pages/blog.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { graphql } from 'gatsby' 3 | import { RootLayout as Layout } from '../Layout' 4 | import { PostCard } from '../PostCard' 5 | 6 | const BlogPage = ({ 7 | data: { 8 | allMdx: { edges }, 9 | }, 10 | }: any) => { 11 | const posts = edges 12 | .filter((edge: any) => !!edge.node.frontmatter.date) 13 | .map((edge: any) => ) 14 | return ( 15 | 16 |
{posts}
17 |
18 | ) 19 | } 20 | 21 | export default BlogPage 22 | 23 | export const pageQuery = graphql` 24 | query ($path: String!) { 25 | allMdx( 26 | sort: { order: DESC, fields: [frontmatter___date] } 27 | filter: { frontmatter: { root: { eq: $path } } } 28 | ) { 29 | edges { 30 | node { 31 | fields { 32 | slug 33 | } 34 | id 35 | excerpt(pruneLength: 250) 36 | frontmatter { 37 | date(formatString: "MMMM DD, YYYY") 38 | title 39 | } 40 | } 41 | } 42 | } 43 | } 44 | ` 45 | -------------------------------------------------------------------------------- /src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { Link } from 'gatsby' 3 | import { Button } from 'antd' 4 | import { GithubOutlined, TwitterOutlined } from '@ant-design/icons' 5 | 6 | const IndexPage = () => { 7 | return ( 8 |
9 |

16 | Gatsby Ant Design Docs Boilerplate 17 |

18 |

A gatsby starter to create documentation websites

19 |

20 | This is a fork of{' '} 21 | 22 | https://github.com/cvluca/gatsby-starter-markdown 23 | 24 |

25 |
26 | 27 | 35 | 43 | 44 | 47 | 48 |
49 | ) 50 | } 51 | 52 | export default IndexPage 53 | -------------------------------------------------------------------------------- /src/sidebar/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { graphql, StaticQuery, Link } from 'gatsby' 3 | import { Affix, Menu } from 'antd' 4 | import 'antd/lib/menu/style/css' 5 | import { pathPrefix } from '../../gatsby-config' 6 | 7 | interface LinkItem { 8 | id: string 9 | name: string 10 | link: string 11 | } 12 | interface ParentItem { 13 | id: string 14 | name: string 15 | items: MenuItem[] | null 16 | } 17 | 18 | type MenuItem = LinkItem | ParentItem 19 | 20 | type Query = { allSidebarJson: { edges: { node: MenuItem }[] } } 21 | 22 | function isLinkItem(item: MenuItem): item is LinkItem { 23 | const result = Boolean((item as LinkItem).link) 24 | return result 25 | } 26 | 27 | function render(item: MenuItem, id: string) { 28 | if (isLinkItem(item)) { 29 | return ( 30 | 31 | 32 |
{item.name}
33 | 34 |
35 | ) 36 | } else { 37 | return ( 38 | {item.name}} 41 | > 42 | {item.items && item.items.map((v, i) => render(v, id + '.' + i))} 43 | 44 | ) 45 | } 46 | } 47 | 48 | export function Sidebar() { 49 | return ( 50 | { 69 | const rootItems = data.allSidebarJson.edges.map((v) => v.node) 70 | const currentPath = 71 | typeof window !== 'undefined' 72 | ? window.location.pathname.replace(pathPrefix, '') 73 | : '/' 74 | const defaultOpenKeys = rootItems.map((item) => item.id) 75 | 76 | return ( 77 | 78 | 84 | {rootItems.map((v) => render(v, v.id))} 85 | 86 | 87 | ) 88 | }} 89 | /> 90 | ) 91 | } 92 | -------------------------------------------------------------------------------- /src/sidebar/sidebar.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Get Started", 4 | "link": "", 5 | "items": [ 6 | { 7 | "name": "Introduction", 8 | "link": "/docs/template/get-started/introduction" 9 | }, 10 | { "name": "Latex", "link": "/docs/template/get-started/latex" } 11 | ] 12 | }, 13 | { 14 | "name": "Guide", 15 | "link": "", 16 | "items": [ 17 | { "name": "Anchor", "link": "/docs/template/guide/anchor" }, 18 | { "name": "Contents", "link": "/docs/template/guide/contents" }, 19 | { "name": "Menu Items", "link": "/docs/template/guide/menu_items" }, 20 | { "name": "Sidebar", "link": "/docs/template/guide/sidebar" } 21 | ] 22 | }, 23 | { 24 | "name": "Lorem Ipsum", 25 | "link": "", 26 | "items": [ 27 | { 28 | "name": "Ipsum", 29 | "link": "/docs/template/lorem-ipsum/Ipsum" 30 | }, 31 | { 32 | "name": "Lorem", 33 | "link": "/docs/template/lorem-ipsum/Lorem" 34 | } 35 | ] 36 | } 37 | ] 38 | -------------------------------------------------------------------------------- /src/templates/template.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import { graphql } from 'gatsby' 3 | import { MDXRenderer } from 'gatsby-plugin-mdx' 4 | import { RootLayout as Layout } from '../Layout' 5 | 6 | function PageTemplate({ data: { mdx } }: any) { 7 | return ( 8 | 9 | {mdx.body} 10 | 11 | ) 12 | } 13 | export const pageQuery = graphql` 14 | query BlogPostQuery($id: String) { 15 | mdx(id: { eq: $id }) { 16 | id 17 | frontmatter { 18 | title 19 | root 20 | } 21 | body 22 | } 23 | } 24 | ` 25 | export default PageTemplate 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["./src/**/*"], 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { "*": ["types/*"] }, 6 | "target": "esnext", 7 | "module": "commonjs", 8 | "lib": ["dom", "es2017"], 9 | // "allowJs": true, 10 | // "checkJs": true, 11 | "jsx": "react", 12 | "strict": true, 13 | "esModuleInterop": true, 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "noEmit": true, 17 | "skipLibCheck": true 18 | }, 19 | "exclude": [] 20 | } 21 | -------------------------------------------------------------------------------- /types/gatsby-mdx.d.ts: -------------------------------------------------------------------------------- 1 | export = index 2 | declare const index: any 3 | --------------------------------------------------------------------------------