FAQ

Frequently answered questions

How can I express a value with leading/trailing or only whitespace?

Use a multiline field - a multiline field's value is retained verbatim, all newlines and whitespace are conserved:

-- my_block

  my content  

-- my_block

In the rare case where a document needs to contain a high number of single-line values that include leading/trailing or even only whitespace you can also consider using a custom type syntax and loader to better express this concept in your application, for instance:

> In our eno documents we use our own custom type syntax for
> expressing a whitespace-only value (in this example 3 spaces)

my_value: "   "
// In our application code we define and utilize a
// reusable loader for loading our own custom type
enolib.register({ whitespace: value => value.replace(/^"|"$/, '') });

// ...

document.field('my_value').requiredWhitespaceValue();  // returns '   '

Can a key include leading/trailing or only whitespace?

This works similar to the example previously given for values:

> In our eno documents we use our own custom type syntax for
> expressing a whitespace-only key (in this example 3 spaces)

"   ": tough readbility
// In our application code we define and utilize a
// reusable loader for loading our own custom type
enolib.register({ whitespace: value => value.replace(/^"|"$/, '') });

// ...

const myValue = document.element().whitespaceKey();  // returns '   '

Note that using eno's escaping does not allow you to express leading/trailing or purely whitespace, the outer spacing in an escape sequence allows to express an ambiguous case of escaping an escape sequence but is always trimmed away:

`` my_name ``: my value 
`` `my_name` ``: my value 

Here the resulting key is 'my_name' in the first and '`my_name`' in the second example.