https://github.com/base-cms/body-import-parser
Cleans/extracts elements from content bodies. For use with content imports.
https://github.com/base-cms/body-import-parser
Last synced: about 1 year ago
JSON representation
Cleans/extracts elements from content bodies. For use with content imports.
- Host: GitHub
- URL: https://github.com/base-cms/body-import-parser
- Owner: base-cms
- License: mit
- Created: 2019-04-02T15:13:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T18:06:24.000Z (over 3 years ago)
- Last Synced: 2025-03-18T08:24:13.722Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://body-import-parser.base-cms.io
- Size: 1.22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Body Import Parser
Cleans/extracts elements from content bodies. For use with content imports.
## Installation
**Note:** _This repository requires **Docker Engine 18.06.0** or greater as Compose file format 3.7 is used._ All commands are assumed to be ran from the project root.
1. Clone the repository
2. Install the project dependencies via `scripts/yarn.sh`
3. Start the service via `docker-compose up app`
4. The service will now be running on `http://0.0.0.0:4986`
## Usage
To run a cleanup/extraction on an HTML string, submit a `POST` request to the desired endpoint (see below). All requests MUST contain the `Content-Type: text/html` header and provide a raw HTML body (not a JSON body or a JSON encoded HTML body). This can be done via cURL, fetch, or any other tool (e.g. Insomnia). The server will return a JSON response with the extracted values and the HTML (the exact format varies depending on the rule).
**Note:** It is assumed that posted HTML will be encoded in UTF-8 (and will respond in-kind). As such, ensure character encoding conversions have been completed _before_ using this service.
### Available Endpoints
- `/pennwell/default` See the rule's [documentation](https://github.com/base-cms/body-import-parser/tree/master/src/rules/pennwell) for more information.
## Managing Dependencies
Because this repository uses Docker, you should _not_ execute Yarn directly. Instead, execute Yarn commands using the provided script. For example, to add a dependency you would run `scripts/yarn.sh add [package-name]` from the project root. This works for all Yarn commands, e.g, `scripts/yarn.sh [command] [args]`
## Additional Scripts
You can execute an interactive terminal (inside the Docker container) via `scripts/terminal.sh`. You can also lint the entire project using `scripts/lint.sh`