Skip to content

Context Docs Copy Code Block Includes Generator Output #6441

@nelsonic

Description

@nelsonic

Environment: Docs

When reading the 2. Your First Context -> Starting with generators docs page for 1.8:
https://hexdocs.pm/phoenix/1.8.0/your_first_context.html#starting-with-generators

Actual behavior

The copy button in the code block copies all of the code block to clipboard:

Image

everything ...

mix phx.gen.html Catalog Product products title:string \
description:string price:decimal views:integer

* creating lib/hello_web/controllers/product_controller.ex
* creating lib/hello_web/controllers/product_html/edit.html.heex
* creating lib/hello_web/controllers/product_html/index.html.heex
* creating lib/hello_web/controllers/product_html/new.html.heex
* creating lib/hello_web/controllers/product_html/show.html.heex
* creating lib/hello_web/controllers/product_html/product_form.html.heex
* creating lib/hello_web/controllers/product_html.ex
* creating test/hello_web/controllers/product_controller_test.exs
* creating lib/hello/catalog/product.ex
* creating priv/repo/migrations/20250201185747_create_products.exs
* creating lib/hello/catalog.ex
* injecting lib/hello/catalog.ex
* creating test/hello/catalog_test.exs
* injecting test/hello/catalog_test.exs
* creating test/support/fixtures/catalog_fixtures.ex
* injecting test/support/fixtures/catalog_fixtures.ex

Add the resource to your browser scope in lib/hello_web/router.ex:

    resources "/products", ProductController

Remember to update your repository by running migrations:

    $ mix ecto.migrate

This isn't particularly useful to a beginner wanting just the generator command to follow the docs as a tutorial/guide ...

Expected behavior

If the command were split from the output, it would be a lot more helpful to a beginner following along:

mix phx.gen.html Catalog Product products title:string \
description:string price:decimal views:integer

After executing the command, you should expect to see output similar to the following:

* creating lib/hello_web/controllers/product_controller.ex
* creating lib/hello_web/controllers/product_html/edit.html.
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions