Skip to content
This repository has been archived by the owner on Jul 19, 2020. It is now read-only.

Improve html docs #100

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Improve html docs #100

wants to merge 12 commits into from

Conversation

zoechi
Copy link
Contributor

@zoechi zoechi commented Jun 16, 2020

No description provided.

src/concepts/html/README.md Outdated Show resolved Hide resolved
src/concepts/html/README.md Outdated Show resolved Hide resolved
src/concepts/html/README.md Outdated Show resolved Hide resolved
src/concepts/html/README.md Outdated Show resolved Hide resolved
@zoechi
Copy link
Contributor Author

zoechi commented Jun 17, 2020

What do you think about changing the numbered list (1. - 5.) to a bullet list?
I don't see the value of these numbers here, especially as the list is growing.
There is no specific order to these points, at least none I'm aware of.

@teymour-aldridge
Copy link
Contributor

Sure, sounds good!

@zoechi
Copy link
Contributor Author

zoechi commented Jun 18, 2020

@teymour-aldridge did you see my last changes?
Anything else to improve?

src/concepts/html/README.md Outdated Show resolved Hide resolved
src/concepts/html/README.md Outdated Show resolved Hide resolved
src/concepts/html/README.md Outdated Show resolved Hide resolved
{% hint style="info" %}
The `html!` macro can reach easily the default recursion limit of the compiler. It is advised to bump its value if you encouter compilation errors. Use an attribute like `#![recursion_limit="1024"]` to bypass the problem. See the [official documentation](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute) and [this Stack Overflow question](https://stackoverflow.com/questions/27454761/what-is-a-crate-attribute-and-where-do-i-add-it) for details.
The [`html!`](https://docs.rs/yew/0.16.2/yew/macro.html.html) macro can reach easily the default recursion limit of the compiler. It is advised to bump its value if you encouter compilation errors. Use an attribute like `#![recursion_limit="1024"]` to bypass the problem. See the [official documentation](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute) and [this Stack Overflow question](https://stackoverflow.com/questions/27454761/what-is-a-crate-attribute-and-where-do-i-add-it) for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The [`html!`](https://docs.rs/yew/0.16.2/yew/macro.html.html) macro can reach easily the default recursion limit of the compiler. It is advised to bump its value if you encouter compilation errors. Use an attribute like `#![recursion_limit="1024"]` to bypass the problem. See the [official documentation](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute) and [this Stack Overflow question](https://stackoverflow.com/questions/27454761/what-is-a-crate-attribute-and-where-do-i-add-it) for details.
The [`html!`](https://docs.rs/yew/0.16.2/yew/macro.html.html) macro can easily exceed the default recursion limit of the compiler. It is advised to bump its value if you encouter compilation errors. Use an attribute like `#![recursion_limit="1024"]` to bypass the problem. See the [official documentation](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute) and [this Stack Overflow question](https://stackoverflow.com/questions/27454761/what-is-a-crate-attribute-and-where-do-i-add-it) for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't really see what exactly the change was here.

What do you think about introducing a fix line length limit?
It's much easier to compare lines that are not broken over several lines.

I don't know what IDE you're using but in Emacs a keyboard shortcut realigns text to fit the defined width.

I just saw that latest works in links instead of a concrete version number.
I think that's better than to update all links with each version increment.

I added a link in another file. I intended to create a new PR for that but missed that I had a type when I tried to switch the branch so it landed in this branch as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

"can reach easily" => "can easily exceed"

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll create an issue (and PR) about line lengths.

@teymour-aldridge
Copy link
Contributor

@zoechi I've suggested a few more improvements (really minor).

@teymour-aldridge
Copy link
Contributor

Otherwise LGTM (looks good to me).

@zoechi
Copy link
Contributor Author

zoechi commented Jun 18, 2020

I added another bullet that I couldn't find documentation for.

Comment on lines +18 to +22
- Quoted attribute values are taken literally. The value is set at compile-time and does not change at run-time.
* `html! { <div> id="bar"</div> }`
- Unquoted attribute values are interpreted as expressions and therefore have to be valid Rust expressions.
* `let foo = "bar"; html! { <div id=foo></div> }`
* `html! { <div id=String::from("foo") + "bar"></div> }`
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit confusing because literals are also expressions. I'd prefer if we left these notes out

- Unquoted attribute values are interpreted as expressions and therefore have to be valid Rust expressions.
* `let foo = "bar"; html! { <div id=foo></div> }`
* `html! { <div id=String::from("foo") + "bar"></div> }`
- HTML tags names need to start with a lowercase letter. Besides that every valid HTML tag name is allowed. If the tag name starts with an uppercase letter it is interpreted as component name and attributes are passed as component properties.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- HTML tags names need to start with a lowercase letter. Besides that every valid HTML tag name is allowed. If the tag name starts with an uppercase letter it is interpreted as component name and attributes are passed as component properties.
- Tag names that begin with a lowercase letter will be treated as the name of a DOM elements.
- Tag names that begin with an uppercase letter will be treated as a type implementing the `Component` trait and the attributes will be passed as component properties.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants