Accès direct au contenu Accès direct à la navigation

DocBook is a simple PHP app to build rich HTML5 views from Markdown files following a filesystem architecture. It embeds some classic CMS’ website features like a search in contents, some RSS feeds generation or translations switching.

DocBook builds a "like-a-book" interactive website from simple Markdown files.

Features

DocBook is a simple application organized beyond a filesystem architecture of Markdown files. Each file is a "page" and each sub-directory is a "section" of pages. The title of the files or directories is used to be the title of the page or section.

The views generated by DocBook are constructed in full HTML5 with the help of Bootstrap.

Special files

Any file named INDEX.md in a directory will be considered as its index and be delivered if no other file is requested in the URL.

Any file named README.md in a directory will be displayed at the bottom of the directory contents indexing, just like the default behavior of Apache.

Files infos

For each file, a set of dependences can be defined to overwrite the default values, that must themselves be defined at the project root directory. These files are, by default :

  • *.copyright.md : a copyright, license or protection information for the file content,
  • *.author(s).md : an information about the author(s) of the file,
  • *.changelog.md : the evolutions informations of the file.

Markdown syntax

The Markdown syntax used by DocBook follows the Markdown Extended rules. They are inherited from :

Translations

Each document can be translated, naming the translation file like :

  1. CONTENT.md
  2. CONTENT.fr.md // translation in French
  3. ...

URL routing

For each file of your DocBook, the following routes are available :

  • */ln?LN : get this content in LN language if present,
  • */download : download the original file of the page,
  • */htmlonly : get the plain HTML version of the page,
  • */plain : get the plain text version of the page.

Data files organization

All your Markdown files, the real pages of your website, have to be stored in the www/ directory or its sub-directories.

Any assets, image or other media file, that you want to include or use in your Markdown contents must be stored in an assets/ sub-directory in the current directory. If you do not follow this rule, your file will not be accessible by Apache.

By default, any file contained in a directory named wip/ will not be displayed publicly and will not be referenced in the sitemap neither in the index ; to view it, you will have to manually write its URL (see the Routing section of this document to learn more about the application URLs’ construction).

Knowing that, a classic DocBook directory organization should be :

  1. | chapter-name/
  2. | ------------- README.md           // the first file shown loading the directory
  3. | ------------- assets/             // a directory containing your medias
  4. | ------------- wip/                // a directory containing your work-in-progress contents
  5. | ------------- PAGE.md             // a Markdown content file (page 1)
  6. | ------------- OTHER-PAGE.md       // another Markdown content file (page 2)
  7. | ------------- OTHER-PAGE.fr.md    // the french translation of page 2
  8. | ------------- sub-chapter1/       // a sub-directory containing a sub-chapter
  9. | ------------- sub-chapter2/       // a sub-directory containing another sub-chapter

The DocBook chapters

All your first depth directories (directories contained directly in your DocBook www/ root) are considered as your chapters and are listed in the header navigation bar of each page for quick access.

Organization

For more informations about how to use DocBook every day, browse the /docbookdoc URL of your installation to read the DocBook user manual. A link to this manual is always accessible in the header navigation bar of each page.

Architecture

The default global architecture of your DocBook is :

  1. | src/
  2. | tmp/
  3. | user/
  4. | www/
  • src/ contains the PHP sources of the application and the template files ; to define a new template, put your file here ; it must follow an architecture like :
  1. | src/
  2. | ---- config/
  3. | ---- DocBook/
  4. | ---- templates/
  • tmp/ is a sub-directory to store some configurations and cached files ; the best practice is to not touch them but you can, in extreme conditions, erase all its contents without worry ; it is (re-)generated by the application ;
  • user/ is the directory to put your own user configuration or templates (see the Fallback system section for more infos) ; you can create it as it doesn’t exist in the distribution ; it may follow an architecture like :
  1. | user/
  2. | ---- config/
  3. | ---- templates/
  • www/ sub-directory must be the DOCUMENT_ROOT of your virtual host (anything outside this directory is not used in HTML pages) ; it must follow an architecture like :
  1. | www/
  2. | ---- docbook_assets/
  3. | ---- .htaccess
  4. | ---- index.php

NOTE - A vendor/ sub-directory will be created by the application in both src/ and www/docbook_assets/ directories to store the vendor external packages used by DocBook ; do not modify them.

Fallback system

The application is constructed to allow user to over-write some configuration settings and the templates used to build the pages. This feature is quite simple :

  • by default, some configurations and templates are embedded with the application in the src/config/ and src/templates/ directories ;
  • any file found in the user/config/ will be taken primary to the default config and any file found in the user/templates/ will be taken primary to the default templates.

The templates follows a specific rule as the application can use a collection of templates to build different designs for pages.

Custom templates

As this application uses Twig to build its views, if you want to write your own templates you may follow Twig’s documentation.

License / Dependencies

DocBook is an open-source application released under a GNU General Public License version 3. You can freely download it, use it or distribute it as long as you stay in the license conditions. See the License file for more infos.

DocBook is developed with the help of the following third-parties :

DocBook is based on some of our other packages :

Voir en ligne : GitHub sources
GNU GPL
Les sources disponibles à l'adresse « https://github.com/atelierspierrot/docbook  » sont mises à disposition sous les termes de la licence Licence Publique Générale (GNU General Public License).