Download the PHP package code16/sharp-doc-reader without Composer
On this page you can find all versions of the php package code16/sharp-doc-reader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sharp-doc-reader
Sharp doc reader
Display a directory of Markdown files as docs inside Sharp: a list of docs, and a page for each one with its table of contents.
Supports Sharp 9 and 10.
Installation
Optionally, publish the config file:
Usage
Create an entity extending DocsEntity, and give it the path of your Markdown files:
There is no list or show class to write. Then declare the entity as any other Sharp entity (discoverEntities() or declareEntity()), and add it to your menu:
Several docs sets
Create one entity per docs set: each has its own path, label, menu entry and policy.
Docs files
- Every
.mdfile of the path is a doc, subfolders included (the list shows the folder). - The title is the
titleof the front-matter if any, else the first# h1, else the headline of the file name. - The first h1 is the page title and is not repeated in the content; the other headings move up a level (
##is rendered as a<h1>), and the<h1>ones make the table of contents. - Docs are sorted by folder, then by
order(front-matter), then by title. - A
guides/index.mdfile is theguidesdoc: its files (e.g. images) can live next to it. - Relative images (
) are resolved from the folder of the doc and served by the package route. - Relative links to another doc's file (
[install](../install/index.md#usage)) lead to the show page of that doc (and to its#usageheading).
The doc ids are the path of the file without extension, / being replaced by . (guides/install.md is guides.install, guides/index.md is guides).
Images route
The files are served by GET /{sharp url segment}/docs-files/{entityKey}/{path}, only for files inside the entity's docs path. The prefix and the middleware can be changed in the config file; by default only logged-in Sharp users can access it.
Markdown rendering
The rendering uses league/commonmark. Options are set in the markdown key of the config file, or per entity:
By default raw HTML is allowed (html_input: allow): only point the entities to docs you trust, or set it to strip.
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of sharp-doc-reader with dependencies
code16/sharp Version ^9.0||^10.0
illuminate/contracts Version ^11.0||^12.0||^13.0
league/commonmark Version ^2.4
spatie/laravel-package-tools Version ^1.16
symfony/yaml Version ^6.4||^7.0||^8.0