Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 1.4 KB

README.md

File metadata and controls

49 lines (42 loc) · 1.4 KB

typograf-now

typograf service provided as a serverless function at https://typograf.now.sh/api/process.

Basic usage

To process text make a POST request to https://typograf.now.sh/api/process with text body parameter.

running the following command in the terminal:

curl -s \
  -d 'text=my "text"' \
  https://typograf.now.sh/api/process

results in:

my «text»

Configuring typograf

Please refer to typograf-cli and typograf documentation to learn more about possible rules.

The service accepts typograf options in the following format:

interface TypografOptions {
    locale: string | string[];
    htmlEntity?: {
        type: 'default' | 'digit' | 'name';
        onlyInvisible?: boolean;
        list?: string[];
    };
    lineEnding?: 'LF' | 'CRLF' | 'CR';
    enableRule?: string | string[];
    disableRule?: string | string[];
}

You can pass custom configuration as options parameter:

curl -s \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"text": "1/2", "options":{"disableRule": ["common/number/fraction"]}}' \
  https://typograf.now.sh/api/process

results in:

1/2