Skip to content

Conversation

@nelsonic
Copy link
Contributor

This PR splits the command from it's output in the docs to fix #6441

Feel free to ignore if you prefer to keep it the way it is ... 👌
I'm sure people can figure it out for themselves, just feels like a unpleasant experience IMO. 🙃

@SteffenDE
Copy link
Contributor

Thank you! I think this is good, but we have more places where this is an issue, so if we change this, I think we should change them all. For example, same page we have mix ecto.migrate with output, but also the same problem in the following guides. I guess another way could be to change ex_doc to only copy lines starting with a shell identifier - if one exists. Let's see what @josevalim thinks :)

@josevalim
Copy link
Member

Unfortunately, I can also see people wanting to copy the whole contents, so splitting the command and the output looks like a good idea to me

@nelsonic
Copy link
Contributor Author

Gents, I'm happy to go through all the docs and apply these changes for consistency. 👌

@SteffenDE
Copy link
Contributor

Very nice, thank you a lot! :)

@nelsonic
Copy link
Contributor Author

Should I apply the changes to this PR or open a separate one? (happy either way, just want to keep it reviewable)

@josevalim
Copy link
Member

This one! Also feel free to do it as separate commits and we will squash it all at the end automatically.

@SteffenDE
Copy link
Contributor

@nelsonic I think we should also do the same for chapter 4 and 5 if you did not already plan to do that.

@nelsonic
Copy link
Contributor Author

@SteffenDE good plan. 🧑‍💻 👌

- Phoenix v1.8 moved the `<.flash_group>` component to the `Layouts` module. You are **forbidden** from calling `<.flash_group>` outside of the `layouts.ex` module
- Out of the box, `core_components.ex` imports an `<.icon name="hero-x-mark" class="w-5 h-5"/>` component for for hero icons. **Always** use the `<.icon>` component for icons, **never** use `Heroicons` modules or similar
- **Always** use the imported `<.input>` component for form inputs from `core_components.ex` when available. `<.input>` is imported and using it will will save steps and prevent errors
- **Always** use the imported `<.input>` component for form inputs from `core_components.ex` when available. `<.input>` is imported and using it will save steps and prevent errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 This and the similar change in usage-rules/phoenix.md could be extracted to a separate PR and merged sooner, as they're simple typo fixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Will split into separate PR when I’m back at my desk tomorrow morning. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate micro-PR to fix: #6492

Copy link
Contributor

@rhcarvalho rhcarvalho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions from an outside contributor who wants to see docs getting better and likes the initiative in this PR :)

```console
$ mix phx.gen.context Catalog Category categories \
mix phx.gen.context Catalog Category categories \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience the console "language" is used when there's a prompt like $ , while shell is used for when there's no prompt.

Examples:

$ mix phx.gen.context Catalog Category categories \
title:string:unique --no-scope
mix phx.gen.context Catalog Category categories \
title:string:unique --no-scope

Not much to syntax highlight anyway :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the $ for console when it shows a command to run :)

Do you want to create a LiveView based authentication system? [Yn]
```

Type `n` followed by `Return` key,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth mentioning the exact keystrokes here. Some keyboards/locales will have enter, some return, maybe others?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take your point. 👌
People tend to know the Return key is interchangeable with Enter. 💭
Just being explicit so people know they need to perform that input. ⌨️


You will see output confirming the migration file was created:

```console
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for pure console output blocks we should use no language hint = no syntax highlight (I'm not part of the Phoenix team, though, just an outside contributor :) -- Steffen and other maintainers have the say here).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there's no language hint, ExDoc uses Elixir, so for just text you want text as language. But console works fine as well. The only thing console does is make the dollar sign at the start of lines non-selectable and ignored when copying.

Suggested change
```console
```text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will apply this suggestion on localhost. 👌

Co-authored-by: Rodolfo Carvalho <rhcarvalho@gmail.com>
@rhcarvalho
Copy link
Contributor

@nelsonic I just realized you're behind @dwyl! I need to say thanks for the great content you and team have produced, I benefitted from it in my early journey with Elixir and Phoenix :)
I also love your business/lifestyle explorations! Thanks 💜

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.

Context Docs Copy Code Block Includes Generator Output

4 participants