# translate-field-to-sanity

> Translate a field of HTML or Markdown within NDJSON to portable text ready for upload

Latest version **0.1.3** (published 2020-07-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install translate-field-to-sanity
pnpm add translate-field-to-sanity
yarn add translate-field-to-sanity
bun add translate-field-to-sanity
```

Provides the command `translate-field-to-sanity`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2020-07-30 |
| First published | 2019-11-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | readeral |

## Links

- npm: https://www.npmjs.com/package/translate-field-to-sanity
- npm.io page: https://npm.io/package/translate-field-to-sanity

## Dependencies (12)

- [jsdom](https://npm.io/package/jsdom.md) 16.1.0
- [ndjson](https://npm.io/package/ndjson.md) ^1.5.0
- [unified](https://npm.io/package/unified.md) ^9.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^7.0.4
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.2.4
- [remark-html](https://npm.io/package/remark-html.md) ^12.0.0
- [remark-parse](https://npm.io/package/remark-parse.md) ^8.0.3
- [inquirer-path](https://npm.io/package/inquirer-path.md) ^1.0.0-beta5
- [@sanity/schema](https://npm.io/package/@sanity/schema.md) ^1.149.16
- [@sanity/block-tools](https://npm.io/package/@sanity/block-tools.md) ^1.149.16
- [inquirer-fuzzy-path](https://npm.io/package/inquirer-fuzzy-path.md) ^2.2.0

## Recent versions

- 0.1.3 (latest) — 2020-07-30
- 0.1.2 — 2020-02-02
- 0.1.1 — 2019-11-21
- 0.1.0 — 2019-11-21

## README

# Translate field to Sanity

This tool (**heavily** borrowing from [markdown-to-sanity](https://github.com/kmelve/markdown-to-sanity) by [kmelve](https://github.com/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:

```sh
npm i -g translate-field-to-sanity

# or

yarn global add translate-field-to-sanity
```

As a project dependency:

```sh
npm i translate-field-to-sanity

# or

yarn add translate-field-to-sanity
```

## Usage

As CLI:

```sh
> 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](https://www.sanity.io/docs/data-store/importing-data).

## 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.

---
_Source: https://npm.io/package/translate-field-to-sanity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
