# Scribble for interaction

**URL:** <https://racket.discourse.group/t/scribble-for-interaction/2964>\
**Category:** Questions & Answers\
**Created:** [June 14, 2024, 4:57pm UTC](https://racket.discourse.group/t/scribble-for-interaction/2964 "2024-06-14T16:57:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendrikboom3](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hendrikboom3/32/2748_2.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Post date:** [June 14, 2024, 4:57pm UTC](https://racket.discourse.group/t/scribble-for-interaction/2964/1 "2024-06-14T16:57:15Z")

</div>

Suppose I want to use scribble in a non-book context.  
For example, for writing messages to be written out during an interactive session with a user.  
Its tools for generating and formatting text and for embedding the output of arbitrary Racket expressions could be valuable for this.  
I'd be delighted to have it produce a HTML or X-expressions and be able to write that out to an output stream or to a web browser using other means.  
But Scribble seems to be set up to produce an entire book as a single file or entire directory of interlinked files -- a rather different scale of operation.

How to do this piecemeal? Is it even conceptually possible with the present structure of Scribble?

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [June 14, 2024, 5:23pm UTC](https://racket.discourse.group/t/scribble-for-interaction/2964/2 "2024-06-14T17:23:07Z")

</div>

You could have a look at the low-level Scribble API ([https://docs.racket-lang.org/scribble/internals.html](https://docs.racket-lang.org/scribble/internals.html)), the pre-processor languages ([https://docs.racket-lang.org/scribble-pp/index.html](https://docs.racket-lang.org/scribble-pp/index.html)), and the way include-template is built ([https://docs.racket-lang.org/web-server/templates.html#%28form.\_%28%28lib.\_web-server%2Ftemplates..rkt%29.\_include-template%29%29](https://docs.racket-lang.org/web-server/templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29)) ?

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [June 14, 2024, 6:26pm UTC](https://racket.discourse.group/t/scribble-for-interaction/2964/3 "2024-06-14T18:26:57Z")

</div>

> [@hendrikboom3](#):
>
> Suppose I want to use scribble in a non-book context.  
> For example, for writing messages to be written out during an interactive session with a user.

Building on @benknoble's suggestions, I'd particularly suggest you look at the section [“Parts, Flows, Blocks, and Paragraphs”](https://docs.racket-lang.org/scribble/core.html#%28part._parts%29), which presents the structures of Scribble's document model, and the introduction to the [“Structures and Processing”](https://docs.racket-lang.org/scribble/core.html) section, which introduces the _traverse_, _collect_, _resolve_, and _render_ passes for managing cross-reference information.

While it's almost certainly possible to express your interactive messages in terms of those constructs, I don't think they'd be an especially good match for that sort of problem.

Instead, you may want to borrow the parts of Scribble (and ideas from Scribble) that are useful, especially @-expressions, but not “use Scribble” in the sense of the `#lang` and API that we often use for writing documentation.

You might also be interested in the [Simple Tree Text Markup](https://docs.racket-lang.org/simple-tree-text-markup/index.html) or [`raart`](https://docs.racket-lang.org/raart/index.html) libraries, though neither target HTML out of the box.
