-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from PrestaShop/doc
Add documentation
- Loading branch information
Showing
1 changed file
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
# contextual-help-api | ||
|
||
API that parses content from PrestaShop User documentations, formats it and serves it to be used inside PrestaShop back-office | ||
## About | ||
|
||
This webapp is in charge of providing the documentation that is displayed in PrestaShop's back-office. | ||
That's the application behind https://help.prestashop-project.org/ | ||
|
||
### How it works? | ||
|
||
When a request is made to this app, the returned documentation is taken from the user documentation's Github repository, | ||
parsed, and converted to either plain HTML or json-encoded HTML. | ||
|
||
Which content from which repository to be taken is related to the request path and/or parameters that indicates PrestaShop's version, | ||
language and back-office page the documentation is needed for. | ||
|
||
There's basically 2 ways you can make request to this app: | ||
|
||
- https://this.app/api/?request=getHelp%3D**page_controller**%26version%3D**prestashop_version**%26language%3D**lang_iso_code**%26callback%3D**jsonp_callback** | ||
- https://this.app/**lang_iso_code**/doc/**page_controller**/?version=**prestashop_version** | ||
|
||
In the first case, the part after `?request=` is actually urlencoded. By using this way, a jsonp response containing the HTML documentation will be returned. | ||
|
||
In the second case, the documentation is returned as plain HTML. | ||
|
||
### Configurations | ||
|
||
The repositories where the documentation is taken from are defined in `config/mapping_urls.yml`. | ||
The markdown files to be used are defined in `config/mapping_v{prestashop_version}`. | ||
|
||
### Markown + Liquid tags | ||
|
||
As the markdown available in the user documentation repositories is made through Gitbook, there's some parts that are not classic markdown. | ||
Those specials features are more or less [liquid tags](https://jekyllrb.com/docs/liquid/tags/) and a special Markdown parsing/rendering extension has been | ||
made to handle them (`src/Markdown/Node/Liquid.php`, `src/Markdown/Parser/Block/LiquidBlock*` and `src/Markdown/Renderer/*`). | ||
|
||
## Requirement | ||
|
||
PHP >= 8.0.7 | ||
|
||
## How to run it | ||
|
||
### Locally | ||
|
||
```shell | ||
$ composer install | ||
$ php -S localhost:8080 -t public/ | ||
``` |