- PHP 94.2%
- CSS 2.7%
- JavaScript 1.3%
- HTML 1.1%
- Shell 0.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PXWEBqRRrhcr99B82FTCE1 |
||
| assets | ||
| blocks | ||
| docs | ||
| docs-site | ||
| languages | ||
| src | ||
| templates | ||
| tests | ||
| CHANGELOG.md | ||
| LICENSE | ||
| lrob-docs.php | ||
| README.md | ||
| release.sh | ||
| uninstall.php | ||
LRob - Docs
A WordPress plugin that turns a folder of Markdown files, kept in a git repository, into the documentation pages of your site.
Your writers edit Markdown files in a repository on Forgejo, Gitea or GitHub, as they would for code. Each time they push, the site publishes the new version: every file becomes a page of the site, in your theme, with its menu, its table of contents and its search-engine tags. Nothing is edited in WordPress.
LRob - Docs is a free plugin by LRob, WordPress host.
For example, a repository like this one:
docs/
├── en/
│ ├── index.md → https://example.com/docs/
│ ├── install.md → https://example.com/docs/install/
│ └── guides/
│ └── backup.md → https://example.com/docs/guides/backup/
└── fr/
└── install.md → https://example.com/fr/docs/install/
becomes these pages. They are real HTML pages built by the server, like any other page of the site: search engines index them, and no JavaScript is needed to display them.
Who it is for
- Software publishers and hosting providers who keep their user documentation next to their code and want it on their WordPress site.
- Teams who prefer to write in Markdown, review changes in pull requests and keep the history in git, rather than edit pages in WordPress.
- Sites with documentation in several languages.
What you get
- Publication on push. The site checks the branch every hour, or at once when the forge calls its webhook. A new commit is downloaded, checked and published in one switch; the previous version stays available to roll back.
- Pages in your theme. Block themes get a "Documentation page" template made of blocks (content, navigation, table of contents, breadcrumbs, related pages, previous/next, language switcher); classic themes get a template too. Every part can be restyled or replaced by the theme.
- Languages. One folder per language. The same file in two folders is the same page in two
languages, with translated addresses, a language switcher and
hreflanglinks. A missing translation redirects to the default language, is shown in it, or answers "not found", as you choose. TranslatePress and Polylang leave these pages alone, and their switchers lead to the right translation. - Pages and versions. Terms of sale, a legal notice or a privacy policy kept in the same
way, at the root of the site (
/terms/), published only when you create a release on the forge, with the date they took effect and the public list of their versions. - Search engines. Title, description, canonical address, Open Graph and structured data, written by the plugin or handed to Rank Math or Yoast SEO; the pages are listed in the WordPress, Rank Math or Yoast sitemap. Old addresses listed in a page's header redirect to it.
- Site assistants. A chatbot that reads content sources, such as LRob - Chatbot, answers from the documentation too: every public page, in each language, kept up to date after each publication.
- Markdown with GitHub's additions. Tables, task lists, footnotes, alerts (
> [!NOTE]), anchors on headings. Links between.mdfiles become links between pages; images are served from the repository. - Updates. New versions of the plugin are offered on WordPress's update screen.
- Migration.
wp lrob-docs export-pagesturns existing WordPress pages into Markdown files, with a report of what needs a hand-written fix.
Installation
- Download
lrob-docs-<version>.zipfrom the releases of this repository. - In WordPress, go to Plugins → Add New → Upload Plugin, choose the zip and activate it.
- Documentation → Languages and URLs: declare your languages (
en,fr…) and the default one. - Documentation → Sources → Add a source: the repository's address
(
https://git.example.com/acme/handbook), the branch, the folder that holds the language folders (docs) and the address prefix on the site (docs). A private repository needs a read-only token. - Save. When Documentation → Status shows Published, the pages are online at
https://example.com/docs/.
The getting started guide has the details, and the documentation covers every setting.
Security
- Tokens. Access tokens and webhook secrets are never shown again once saved, and can be
kept in
wp-config.phpinstead of the database. A token is only sent to the forge's API, never to another host, and never through a redirect. - Webhook. Each call must be signed with the source's secret (HMAC-SHA256); anything else is refused.
- Repository content. Only Markdown files, the navigation file and the allowed media types are taken from the repository: no PHP or other file reaches the server. The archive is checked entry by entry (no path outside its folder, no link, size and count limits).
- Pages. HTML written in the Markdown is filtered like post content, and links that would run a script are neutralised.
- Storage. The extracted files are protected from direct access on Apache and IIS. On nginx, deny access to the storage folder or move it outside the web root (one setting).
- No shell. The plugin never runs
gitor any other program: everything goes through the forge's HTTP API.
Requirements
- WordPress 6.7 or later.
- PHP 8.4 or later, with the
zip,mbstringandctypeextensions. Developed and tested on PHP 8.5. - A repository on Forgejo, Gitea or GitHub that the server can reach over HTTPS.
Status
0.1.x: an early pre-release. Settings, file formats and behaviour may still change before 1.0.
Development
No dependency and no build step: plain PHP, CSS and JavaScript. Markdown and YAML are read by two
bundled libraries, src/lib/markdown and
src/lib/yaml, which are copies of their own repositories. Design
notes for contributors are in docs/SPEC.md.
Tests are plain PHP scripts:
php tests/unit.php # the plugin's logic, no WordPress needed
php src/lib/markdown/tests/run.php # the Markdown library
php src/lib/yaml/tests/run.php # the YAML library
What depends on WordPress itself is then checked on a staging site with the release zip.
sh release.sh builds dist/lrob-docs-<version>.zip (versions checked, translations compiled
with msgfmt); sh release.sh pot refreshes the translation template. A version is published
as a forge release tagged v<version> with the zip attached.
Credits
The Markdown parser adapts the block and inline parsers of
commonmark.js by John MacFarlane (BSD 2-Clause,
see src/lib/markdown/NOTICE).
Licence
GPL-2.0-or-later. See LICENSE.