# `mix kotoba.gen.node`
[🔗](https://github.com/hattoriai/kotoba/blob/v0.5.0/lib/mix/tasks/kotoba.gen.node.ex#L1)

Generates the two halves of an app-defined node, and a test.

    $ mix kotoba.gen.node Callout
    $ mix kotoba.gen.node Pointer --kind inline

For an app `:my_app`, `mix kotoba.gen.node Callout` writes:

  * `lib/my_app/kotoba/nodes/callout.ex` - `MyApp.Kotoba.Nodes.Callout`,
    a `Kotoba.Node` of type `"my-app-callout"` with a `label` field and
    its render callbacks. The type starts with the app name, so it
    cannot be the type of a built-in node.
  * `assets/js/kotoba/nodes/callout.js` - the Lexical node for the editor.
    The module exports a default factory, `(lexical) => class`, so that
    the class extends the editor's own copy of Lexical.
  * `test/my_app/kotoba/nodes/callout_test.exs` - a test that parses,
    renders and reads the text of a document with the node.

Then it prints the config line and the component attribute that register
the node.

## Options

  * `--kind` - `decorator` (the default), `inline` or `block`. An inline
    node goes in a paragraph; a block node and a decorator go in the
    document root.
  * `--app` - the application name. The default is the `:app` of the
    Mix project.
  * `--module` - the name of the Elixir module, for example
    `MyApp.Content.Callout`. Its last part must be the node name. The
    default is `<App>.Kotoba.Nodes.<Name>`. The Elixir file and the test
    follow the module name (`lib/my_app/content/callout.ex`).
  * `--out` - the directory to write the files in, for an app that is not
    at the root of the working directory. The default is `.`.
  * `--force` - replaces files that exist. Without it, the task stops
    when one of the files exists.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
