Skip to content
https://github.com/typograf/typograf service provided as a serverless function hosted on now.sh.
TypeScript
Branch: master
Clone or download
tplk Merge pull request #7 from tplk/renovate/now-node-1.x
chore(deps): update dependency @now/node to v1.2.0
Latest commit 62dc73f Nov 22, 2019

README.md

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
You can’t perform that action at this time.