Skip to main content

seedling-data-plugin-yaml

A data plugin to read and parse YAML data.

Usage

  1. Create a new file in /data with the name yaml.ts.
import json from "https://deno.land/x/seedling_data_plugin_yaml@0.0.1/mod.ts";
export default yaml;
  1. Use with seedling data directive. There are three ways to use the directive.

As raw inline YAML

  <:data use="yaml">
    foo: bar
    baz:
      - qux
      - quux
  </:data>

From a local file

<:data use="yaml" file="path/to/json/file.yaml" />

Note - This plugin requires the --allow-read command line parameter for Deno when using file attribute.

From a remote url

<:data use="yaml" url="https://example.com/path/to/file.yaml" />

Note - This plugin requires the --allow-net command line parameter for Deno when using url attribute.

Multiple YAML Documents

If you have a YAML document with multiple entries within it, seperated by ---, you can pass multiple attribute to the directive to get an array of the parsed values.

  <:data use="yaml" multiple>
    ---
    id: 1
    name: Alice
    ---
    id: 2
    name: Bob
    ---
    id: 3
    name: Eve
  </:data>