Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer headlines with syntax examples #2925

Merged
merged 1 commit into from
Jun 16, 2019
Merged

Conversation

trbrc
Copy link
Contributor

@trbrc trbrc commented Jun 1, 2019

I found it hard to use parts of the docs because their headlines did not remind me of the syntax they describe. Especially “Actions”, which is called use in code. While I was at it I added short syntax examples to a number of other headlines as well. Hopefully this makes it easier to get an overview of the syntax and to lookup documentation for code you may not be 100% sure what it does, without relying on ⌘F.

Fair warning: I did this PR from my phone, so autocorrect might have snuck in a typo somewhere.

Change headline “Actions” to “Use directive” + add a number of additional syntax examples, to make it easier to find the relevant section without ⌘F
@@ -392,7 +392,7 @@ As with DOM events, if the `on:` directive is used without a value, the componen
<SomeComponent on:whatever/>
```

### Element bindings
### Element bindings (bind:property)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it make more sense to refer to this as bind:attribute?

@@ -1047,7 +1049,7 @@ A custom animation function can also return a `tick` function, which is called *



### Slots
### &lt;slot&gt;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or Slots (<slot>), but it felt a little redundant...

@Conduitry
Copy link
Member

What I'm concerned about with this is it breaking all links to these sections out in the wild. We would be able to update links to these sections from the tutorial and from the Sapper docs (if there are any to any of these sections? not sure), but we wouldn't be able to do anything about any of the other links floating out there in chat or in other people's articles about Svelte or anywhere else.

@trbrc
Copy link
Contributor Author

trbrc commented Jun 4, 2019

@Conduitry That's a really good point. I've certainly been frustrated by the same thing when following hash links to various readme's and docs before.

It sounds like something that's bound to happen sooner or later, though. Is there some established practice to "redirect" anchor links? Or would it make sense to use anchors that aren't auto-generated from the text itself, so text and anchor ID can be changed independently?

@Rich-Harris
Copy link
Member

Stable anchors are definitely preferable, though I don't think they should stand in the way of significant improvements. I think some method of redirection is probably our best bet.

My larger concern here is that this is fugly:

Screen Shot 2019-06-06 at 08 34 21

Maybe the headlines should more directly reflect the syntax?

Screen Shot 2019-06-06 at 08 44 42

Come to think of it, I wonder if we should separate out element directives from component directives:

Screen Shot 2019-06-06 at 09 03 37

Needs a little bit more work, but you get the idea. Thoughts?

@trbrc
Copy link
Contributor Author

trbrc commented Jun 6, 2019

Yes, even better IMO, after all it’s supposed to be an API reference. The concepts are handled much better by tutorials and examples.

@paulocoghi
Copy link
Contributor

@Rich-Harris

Come to think of it, I wonder if we should separate out element directives from component directives:

+1!

@Rich-Harris Rich-Harris mentioned this pull request Jun 9, 2019
@Rich-Harris Rich-Harris merged commit b4b9edf into sveltejs:master Jun 16, 2019
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.

4 participants