Skip to content

Commit 443c8fc

Browse files
authored
Merge branch 'main' into bugfix/mdsections
2 parents ed95dc6 + dc17550 commit 443c8fc

File tree

77 files changed

+1041
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1041
-322
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
dependency-versions: "highest"
3838

3939
- name: "Run guides-cli"
40-
run: "vendor/bin/guides -vvv --no-progress docs --output='/tmp/test' --fail-on-log"
40+
run: "vendor/bin/guides -vvv --no-progress docs --output='/tmp/test' --fail-on-error"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ test-xml: ## Lint all guides.xml
4747
./tools/xmllint.sh
4848

4949
.PHONY: test-docs
50-
test-docs: ## Generate projects docs without warnings
51-
$(PHP_BIN) vendor/bin/guides -vvv --no-progress docs --output="/tmp/test" --fail-on-log
50+
test-docs: ## Generate projects docs without errors
51+
$(PHP_BIN) vendor/bin/guides -vvv --no-progress docs --output="/tmp/test" --fail-on-error
5252

5353
.PHONY: cleanup
5454
cleanup: cleanup-tests cleanup-build cleanup-cache

docs/_uml/application-flow.puml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@startuml
2+
3+
start
4+
:Parser;
5+
:Compiler;
6+
:render;
7+
stop
8+
9+
@enduml

docs/about.rst

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/architecture.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
============
2+
Architecture
3+
============
4+
5+
The project is built around the core library that is called ``guides``. This library
6+
contains all core components of the project. Like the different layers :ref:`parser-component`,
7+
:ref:`compiler-component` and :ref:`renderer-component` and includes the basic Nodes and templates to create
8+
output.
9+
10+
Installation of the core library can be done using ``composer``:
11+
12+
.. code-block:: bash
13+
14+
composer require phpdocumentor/guides
15+
16+
The other components are using the core library and extend it with additional
17+
functionality. For example the ``guides-markdown`` component adds support for
18+
Markdown documents and the ``guides-restructuredtext`` component adds support for
19+
ReStructuredText documents.
20+
21+
All components are designed to be open for extension so you can bring your own parser,
22+
template engine or other component. The core library is designed to be the glue between
23+
all components.
24+
25+
The ``guides``, ``guides-markdown`` and ``guides-restructuredtext`` are seen as the main
26+
libaries of the project. The other components are optional and can be used to extend the
27+
functionality of the main libraries for specific use cases.
28+
29+
Application flow
30+
================
31+
32+
Processing documents is done in a few steps.
33+
34+
#. :php:class:`Parsing <\phpDocumentor\Guides\Parser>` The first step is to parse the document.
35+
This is done by the :ref:`parser-component` component. The
36+
parser component will parse the document and create a tree of nodes. Each node
37+
represents a part of the document. For example a paragraph, a list or a table.
38+
#. :php:class:`Compiling <\phpDocumentor\Guides\Compiler\Compiler>` The second step is to compile the tree of nodes.
39+
This is done by the :ref:`compiler-component`
40+
component. During the compilation, modifications can be made to the tree of nodes. For
41+
example the compiler can add a table of contents to the tree of nodes.
42+
43+
#. :php:class:`Rendering <\phpDocumentor\Guides\Renderer\BaseTypeRenderer>` The third step is to render
44+
the tree of nodes. This is done by the :ref:`renderer-component`
45+
component. The render component will render the tree of nodes to a specific output
46+
format. By default twig templates are used to render nodes to HTML. But you can
47+
create your own templates to render nodes to other formats. Or implement your own
48+
renderer to use a different template engine.
49+
50+
.. uml:: _uml/application-flow.puml
51+
:caption: Application flow

docs/cli/basic-config.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<guides xmlns="https://www.phpdoc.org/guides"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://www.phpdoc.org/guides vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
5+
input="docs"
6+
output="build/docs"
7+
input-format="rst"
8+
>
9+
<project title="phpDocumentor Guides"/>
10+
</guides>

docs/cli/configuration.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.. include:: /include.rst.txt
2+
3+
=============
4+
Configuration
5+
=============
6+
7+
The cli tool is able to read configuration from a ``guides.xml`` file.
8+
You should put this file in the current working directory where you execute
9+
the tool. Generally speaking, this is the root of your project.
10+
11+
Using a configuration file allows you to set project-specific settings and
12+
keep them under version control. Not all options available in the configuration
13+
are available on the command line. Such as the :ref:`extension configuration`.
14+
15+
.. note::
16+
17+
The ``guides.xml`` file is not required. If it is not present, the tool
18+
will use the default configuration.
19+
20+
Global configuration
21+
====================
22+
23+
Settings that you want to have regardless of the documentation you are
24+
building should live in ``guides.xml`` in the current working directory.
25+
26+
.. literalinclude:: ./basic-config.xml
27+
:language: xml
28+
29+
See the ``guides.xsd`` file for all available config options.
30+
31+
Extension configuration
32+
=======================
33+
34+
Some extensions allow extra configuration to be added to the ``guides.xml``
35+
36+
.. literalinclude:: ./extension-config.xml
37+
:language: xml
38+
39+
.. hint::
40+
41+
If you want to learn more about the extensions, see the :doc:`/developers/extensions/index` documentation.

docs/cli/extension-config.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<guides xmlns="https://www.phpdoc.org/guides"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://www.phpdoc.org/guides vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
5+
6+
html-theme="bootstrap"
7+
>
8+
<extension class="phpDocumentor\Guides\Bootstrap" />
9+
<extension class="phpDocumentor\Guides\Code">
10+
<language name="php" />
11+
</extension>
12+
</guides>

docs/cli/first-docs.png

25.8 KB
Loading

docs/cli/index.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.. include:: /include.rst.txt
2+
3+
================
4+
Getting started
5+
================
6+
7+
This section describes how to use the commandline tool and how to configure it.
8+
The commandline tool is a small wrapper around the core library and can be used
9+
to render RST and Markdown files to HTML.
10+
11+
Create your first documentation
12+
===============================
13+
14+
After :doc:`/installation` you can directly start to create your first documentation.
15+
to do this, create a new directory named ``docs`` and create a file called ``index.rst`` in it.
16+
17+
.. code-block:: rst
18+
19+
My first documentation
20+
======================
21+
22+
This is my first documentation. It is written in reStructuredText.
23+
24+
.. toctree::
25+
:maxdepth: 2
26+
27+
chapter1
28+
chapter2
29+
30+
Now run the command to render the documentation:
31+
32+
.. code-block:: bash
33+
34+
$ ./vendor/bin/guides docs
35+
36+
You will find the output in the ``output`` directory and it should look like this:
37+
38+
.. image:: first-docs.png
39+
:alt: Example index file rendered to HTML
40+
41+
Now you can start to write your documentation or read the :doc:`./configuration` section
42+
to learn more about the configuration.
43+
44+
.. toctree::
45+
:hidden:
46+
47+
configuration
48+
49+
Extending
50+
=========
51+
52+
Like any other component in this repository, the commandline tool can be extended. This can
53+
be done using an extension class, and referencing this class in the configuration file, like
54+
shown for in the :ref:`.extension-configuration` section.

0 commit comments

Comments
 (0)