Link Search Menu Expand Document
Table of contents
  1. Not calling eval
  2. Calling eval

Check out the original file to see the original source.

Not calling eval

It won’t change or eval an unrecognized language.

```python
raise Exception("...")
```
raise Exception("...")

It won’t change or eval a block that’s not being evaluated.

```ts
throw new Error("...");
```
throw new Error("...");

Calling eval

Eval blocks can be meta. These tests make extensive use of this feature.

```ts eval --meta
// some code
```
// some code

It evaluates a block of code from a recognized language that calls eval.

```ts eval --meta
const nothing = (_arg: number) => void 0;
```
const nothing = (_arg: number) => void 0;

It prints inlay hints

```ts eval --meta --out=hide
const nothing2 = () => nothing(123);
nothing2();
```
const nothing2 = () => nothing(/* _arg: */ 123);
nothing2();

It captures values from the evaluated code, that will be printed in the generated markdown.

```ts eval --meta
const add1 = (it: number) => it + 1;
add1(3);
```
const add1 = (it: number) => it + 1;
add1(/* it: */ 3);
4

By default, values print as json.

({ a: 1 });
{ "a": 1 }

The output language can be overridden

```ts eval --out=jsonjs --meta
({
    a: 1,
});
```
({ a: 1 });
{ a: 1 }

The fenced code block can be hidden

```ts eval --meta --hide
({ hide: "me", n: 123 + 456 });
```
{ "hide": "me", "n": 579 }

The output can be hidden

```ts eval --meta --out=hide
({ hide: "me", n: 123 + 456 });
```
({ hide: "me", n: 123 + 456 });

It doesn’t delete comments

// @ts-expect-error
1 + false;
1

This document used eval-md