Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eval.wrap option #158

Merged
merged 1 commit into from
Nov 25, 2023
Merged

Add eval.wrap option #158

merged 1 commit into from
Nov 25, 2023

Conversation

jaspervdj
Copy link
Owner

This adds a new wrap section to the eval configuration.

By default, the output is wrapped in a code block again with the original syntax highlighting. You can customize this behaviour by setting wrap to:

  • code: the default setting.
  • raw: no formatting applied.
  • rawInline: no formatting applied and no trailing newline.

You can use rawInline to draw graphics. In order to do that, for example, we could configure kitten code snippets to evaluate using Kitty's command icat. This uses the rawInline code setting to ensure that the resulting output is not wrapped in a code block, and the fragment and replace settings immediately replace the snippet:

---
patat:
  eval:
    kitten:
      command: sed 's/^/kitten /' | bash
      replace: true
      fragment: false
      wrap: rawInline
...

See, for example:

```kitten
icat --align left dank-meme.jpg
```

This adds a new `wrap` section to the `eval` configuration.

By default, the output is wrapped in a code block again with the original syntax
highlighting.  You can customize this behaviour by setting `wrap` to:

 *  `code`: the default setting.
 *  `raw`: no formatting applied.
 *  `rawInline`: no formatting applied and no trailing newline.

You can use `rawInline` to draw graphics.  In order to do that, for example,
we could configure `kitten` code snippets to evaluate using [Kitty]'s
command `icat`.  This uses the `rawInline` code setting to ensure that the
resulting output is not wrapped in a code block, and the `fragment` and
`replace` settings immediately replace the snippet:

    ---
    patat:
      eval:
        kitten:
          command: sed 's/^/kitten /' | bash
          replace: true
          fragment: false
          wrap: rawInline
    ...

    See, for example:

    ```kitten
    icat --align left dank-meme.jpg
    ```

[Kitty]: https://sw.kovidgoyal.net/kitty/
@jaspervdj jaspervdj merged commit aa88edc into main Nov 25, 2023
9 checks passed
@jaspervdj jaspervdj deleted the eval-wrap branch November 25, 2023 12:59
@jaspervdj jaspervdj mentioned this pull request Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant