Skip to content

Commit

Permalink
Merge pull request #16 from PrestaShop/doc
Browse files Browse the repository at this point in the history
Add documentation
  • Loading branch information
matks authored Nov 17, 2022
2 parents 3869db4 + 97c0279 commit e6e27e0
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion README.md
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:

- http​s://this.app/api/?request=getHelp%3D**page_controller**%26version%3D**prestashop_version**%26language%3D**lang_iso_code**%26callback%3D**jsonp_callback**
- http​s://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/
```

0 comments on commit e6e27e0

Please sign in to comment.