Skip to content

tplk/typograf-now

Repository files navigation

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

About

https://github.com/typograf/typograf service provided as a serverless function hosted on now.sh.

Resources

License

Stars

Watchers

Forks

Packages

No packages published