# smarkt

> Hyper-readable plain text format

Latest version **0.0.6** (published 2018-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install smarkt
pnpm add smarkt
yarn add smarkt
bun add smarkt
```

## 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.0.6 |
| Published | 2018-03-06 |
| First published | 2017-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 74 |
| Author | Jon-Kyle |
| Maintainers | jondashkyle |
| Keywords | markdown, yaml, formatting, plain txt |

## Links

- npm: https://www.npmjs.com/package/smarkt
- Repository: https://github.com/jondashkyle/smarkt
- Homepage: https://github.com/jondashkyle/smarkt#readme
- Issues: https://github.com/jondashkyle/smarkt/issues
- npm.io page: https://npm.io/package/smarkt

## Dependencies (3)

- [xtend](https://npm.io/package/xtend.md) ^4.0.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.10.0
- [object-keys](https://npm.io/package/object-keys.md) ^1.0.11

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2018-03-06
- 0.0.5 — 2018-02-17
- 0.0.4 — 2018-02-17
- 0.0.3 — 2018-02-06
- 0.0.2 — 2018-02-01
- 0.0.1 — 2017-12-23

## README

<h1 align="center">📃 smarkt</h1>

<div align="center">Hyper-readable structure for defining fields and values in plain text</div>

## Usage

Transform some structured plain text including Markdown and YAML into JSON, and visa versa. Super useful for archivability and readability. Feature parity with Kirby’s [file structure](https://getkirby.com/docs/content/adding-content).

```js
var smarkt = require('smarkt')

var str = smarkt.parse(`
title: Cyber Mysticism
----
tags:
  - technopastoral
  - ambient
----
text: Art has always been a focusing device, the frame is a focusing device. What I’m trying to do is eliminate the frame, eliminate all those distractions and put you in direct relationship to the real experience and the real power: your ability to perceive.
`)

var obj = smarkt.stringify({
  title: 'Cyber Mysticism',
  { tags: ['technopastoral', 'ambient']},
  text: 'Art has always been a focusing device, the frame is a focusing device. What I’m trying to do is eliminate the frame, eliminate all those distractions and put you in direct relationship to the real experience and the real power: your ability to perceive.'
})
```

## Structure

A plain-text file is separated into fields delineated by four dashes. 

```
----
````

Give the field a name and define it’s value.

```
title: Cyber Mysticism
```

The value can also be YAML.

```
tags:
  - technopastoral
  - ambient
```

<details id="example-input">
<summary>Plain text input expanded</summary>

```
title: Cyber Mysticism
----
tags:
  - technopastoral
  - dark-ux
----
design:
  desktop:
    background: red
    navigation: false
  mobile:
    background: blue
    navigation: true
----
text:

Information wants to be free.
```

</details>


<details id="example-output">
<summary>JSON output expanded</summary>

```json
{
  "title": "Cyber Mysticism",
  "tags": ["technopastoral", "dark-ux"],
  "design": {
    "desktop": {
      "background": "red",
      "navigation": false
    },
    "mobile": {
      "background": "blue",
      "navigation": true
    }
  },
  "text": "Information wants to be free."
}
```

</details>

## Methods

### `stringify`

Accepts a single argument which must be type `string`. Returns an `object`.

### `parse`

Accepts a single argument which must be type `object`. Returns a `string`.

## Alternate usage

```
var stringify = require('smarkt/stringify')
var parse = require('smarkt/parse')
```

Sometimes it’s handy just to access a single method to reduce bundle size. To do this, simply require the desired method by name.

## Todo

- [ ] Tests
- [ ] `.stringify` Remove quotes around YAML array values

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