-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
2,314 additions
and
55 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Unit tests | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
steps: | ||
- name: Main checkout | ||
uses: actions/checkout@v2 | ||
|
||
# node setup | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
# node cache | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v1 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
# node install | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
# Unit tests | ||
- name: Unit tests | ||
run: yarn test |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"npm": { | ||
"publish": true | ||
}, | ||
"git": { | ||
"commitMessage": "chore: release v${version}" | ||
}, | ||
"github": { | ||
"release": true | ||
}, | ||
"plugins": { | ||
"@release-it/conventional-changelog": { | ||
"infile": "CHANGELOG.md", | ||
"preset": { | ||
"name": "conventionalcommits", | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
}, | ||
{ | ||
"type": "refactor", | ||
"section": "Changes" | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Maintenance" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Empty file.
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,44 @@ | ||
# Blocks Conversion Tool | ||
|
||
A tool to convert HTML (as used in Plone Classic) to Blocks (as used on Volto) | ||
[![NPM](https://img.shields.io/npm/v/@plone/blocks-conversion-tool.svg)](https://www.npmjs.com/package/@plone/blocks-conversion-tool) | ||
[![Code analysis checks](https://github.com/plone/blocks-conversion-tool/actions/workflows/code.yml/badge.svg)](https://github.com/plone/blocks-conversion-tool/actions/workflows/code.yml) | ||
[![Unit tests](https://github.com/plone/blocks-conversion-tool/actions/workflows/unit.yml/badge.svg)](https://github.com/plone/blocks-conversion-tool/actions/workflows/unit.yml) | ||
|
||
## Introduction | ||
|
||
This package implements a server with a simple API to convert HTML (as used in Plone Classic) to Blocks (as used on Volto). | ||
|
||
## Starting the server | ||
|
||
### From source | ||
|
||
```shell | ||
git clone https://github.com/plone/blocks-conversion-tool.git | ||
cd blocks-conversion-tool | ||
yarn install | ||
yarn start | ||
``` | ||
|
||
### With Docker | ||
|
||
```shell | ||
docker run -it -p 5000:5000 plone/blocks-conversion-tool:latest | ||
``` | ||
|
||
## Usage | ||
|
||
## HTML to Blocks (Slate) | ||
|
||
[Slate](https://github.com/eea/volto-slate) is going to be the default text block for Plone 6, to convert HTML to an array of blocks call the service passing the HTML as shown below: | ||
|
||
```shell | ||
curl -i -X POST http://localhost:5000/html -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"html": "<p>Hello world!</p>"}' | ||
``` | ||
|
||
## HTML to Blocks (DraftJS) | ||
|
||
Draft-JS is the legacy default text block used in Volto. | ||
|
||
```shell | ||
curl -i -X POST http://localhost:5000/html -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"html": "<p>Hello world!</p>", "converter": "draftjs"}' | ||
``` |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
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
Oops, something went wrong.