translate-field-to-sanity

0.1.3 • Public • Published

Translate field to Sanity

This tool (heavily borrowing from markdown-to-sanity by kmelve) takes in an existing ndjson import file containing body text that needs translating from HTML or Markdown into portable-text (the block text type in Sanity.io). It will output an ndjson file with the required formatting for import.

Installation

As a global CLI tool:

npm i -g translate-field-to-sanity

# or

yarn global add translate-field-to-sanity

As a project dependency:

npm i translate-field-to-sanity

# or

yarn add translate-field-to-sanity

Usage

As CLI:

> translate-field-to-sanity # follow the instructions

The CLI will write a ndjson-file you can use with sanity dataset import. Learn more about importing data to Sanity.

Gotchas

If you want to have a line break in your text string like Here is a line break\nNew line starts here then your HTML will need to use &#10; to represent the linebreak, not a <Br /> tag. If you use a <Br /> tag, you will get a /n character, but it will be within its own span in the Sanity block text. Using &#10; ensures it remains in-line with the current string.

Readme

Keywords

none

Package Sidebar

Install

npm i translate-field-to-sanity

Weekly Downloads

1

Version

0.1.3

License

ISC

Unpacked Size

8.96 kB

Total Files

9

Last publish

Collaborators

  • readeral