├── .gitignore ├── README.md ├── banner.png ├── composer.json ├── composer.lock ├── dist ├── styles-dark.css └── styles-light.css ├── mix-manifest.json ├── package-lock.json ├── package.json ├── phpunit.xml.dist ├── src ├── Facades │ └── GitDown.php ├── GitDown.php ├── GitDownServiceProvider.php ├── config-stub.php └── sass │ ├── styles-dark.scss │ └── styles-light.scss ├── tests └── GitDownTest.php ├── webpack.mix.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | node_modules/ 3 | .idea/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | # GitDown 4 | A simple package for parsing (GitHub Flavored) Markdown in PHP. 5 | 6 | ## WARNING 7 | This package is a fraud. All it does is fire off your markdown to a [public GitHub API](https://developer.github.com/v3/markdown/) that returns the parsed result. 8 | 9 | Knowing this, if you don't store the result, or take advantage of the provided caching features, you'll end up with slow page loads, or worse, rate-limit errors from GitHub. 10 | 11 | Markdown parsing is super annoying, and this tradeoff is well worth it to me, I hope you embrace it as well. 12 | 13 | ## Installation 14 | 15 | ```bash 16 | composer require calebporzio/gitdown 17 | ``` 18 | 19 | ## TLDR; 20 | 21 | ```php 22 | // Optionally set a GitHub Personal Access Token to increase rate-limit. 23 | GitDown::setToken($token); 24 | 25 | GitDown::parse($markdown); 26 | 27 | // Uses Laravel's cache()->rememberForever() under the hood. 28 | GitDown::parseAndCache($markdown); 29 | ``` 30 | 31 | Optionally, add the `@gitdown` snippet to your template's `
` section, and a `.markdown-body` class to a wrapper element, for GitHub markdown/code-syntax styling. 32 | 33 | ```html 34 | 35 | [...] 36 | @gitdown 37 | 38 | 39 |