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

Create skeleton of documentation #632

Merged
merged 11 commits into from
Oct 22, 2024
Merged

Create skeleton of documentation #632

merged 11 commits into from
Oct 22, 2024

Conversation

PoignardAzur
Copy link
Contributor

@PoignardAzur PoignardAzur commented Oct 6, 2024

This is a very messy, very basic skeleton of what Masonry documentation will eventually look like.

Main points are:

  • Dedicated documentation modules.
  • Re-using most of the language from the RFCs.

Next steps are:

  • Flesh out the Widget documentation.
  • Rewrite all those docs in a less placeholder-y way.
  • Add chapter about the widget arena.
  • Spread out that pass documentation to the respective pass files.
  • Rewrite ARCHITECTURE.md.
  • Add screenshots.

Fixes #376 and #389.

masonry/src/lib.rs Outdated Show resolved Hide resolved
@PoignardAzur PoignardAzur force-pushed the doc_masonry_1 branch 2 times, most recently from be17e47 to 564b440 Compare October 17, 2024 16:28
@PoignardAzur PoignardAzur marked this pull request as ready for review October 20, 2024 13:16
@PoignardAzur
Copy link
Contributor Author

I'm marking this as ready for review despite the TODOs because I think this is a stark improvement over the previous state of our documentation.

The next be steps would be:

  • Writing the "Testing widgets" chapters.
  • Rewriting doc in the rest of the crate to reference this tutorial (and especially the "Concepts and definitions" chapter).


Let's start with the `main()` function.

```ignore
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
```ignore
```rust,ignore

I'm not sure if the Github markdown renderer (or others) handles this better (i.e. syntax highlighting), but at least it has a chance to know that this is rust code.

(Same for the other ignore here)

I also wonder, if we should design these inline examples such that they compile, so that they're always in sync and checked via CI.
But I see this may increase the (not so interesting) code in these examples.
That could probably be avoided by # code that should not be rendered but that on the other hand has the disadvantage, to be shown in other markdown renderers (though I'd rather accept that TBH and be sure that everything is in sync).

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 also wonder, if we should design these inline examples such that they compile, so that they're always in sync and checked via CI.

You're welcome to try. It's tough to do it in a way that doesn't make the examples tedious and unreadable. (Unless you use a lot of # marker to hide code from the reader.)

Copy link
Member

Choose a reason for hiding this comment

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

This also interacts with #501. That is, we definitely should make these proper examples, but that work can reasonably be deferred.

Yes, that would involve using hidden harness code.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

I've scanned through the first three chapters. There are a few grammar issues, but overall this is looking really good.

I have also make a few UX suggestions. mostly for people who stumble upon this in GitHub

@@ -0,0 +1,238 @@
# Building a "To-Do List" app

**TODO - Add screenshots - see [#501](https://github.com/linebender/xilem/issues/501)**
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
**TODO - Add screenshots - see [#501](https://github.com/linebender/xilem/issues/501)**
<!-- TODO - Add screenshots - see [#501](https://github.com/linebender/xilem/issues/501) -->

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 think I'll leave it as-is. I'd rather have a visible reminder.

masonry/src/doc/mod.rs Outdated Show resolved Hide resolved
masonry/src/doc/mod.rs Outdated Show resolved Hide resolved
masonry/src/lib.rs Show resolved Hide resolved
masonry/src/doc/01_creating_app.md Show resolved Hide resolved
masonry/src/doc/02_implementing_widget.md Outdated Show resolved Hide resolved
masonry/src/doc/02_implementing_widget.md Show resolved Hide resolved
color: Color,
}
impl WidgetMut<'_, ColorRectangle> {
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised that this works - I thought it would be a coherence break

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't work, hence the TODO comment. The final doc will use the free-function syntax.

masonry/src/doc/02_implementing_widget.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Looks good!


- Being hovered.
- Having pointer capture.
- Having local text focus.
Copy link

Choose a reason for hiding this comment

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

Below, you describe 'active text focus' and 'inactive text focus'. What's 'local text focus', though?

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 think it's the same. Basically there's "the widget is focused, but the window isn't", and "the widget and the window are both focused". I need to take another crack at explaining this.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

Other than #632 (comment), I think this is ready to land.

I've not carefully re-reviewed since my last round, but overall it's better to get this in and allow updates to be collaborative.

@runiq
Copy link

runiq commented Oct 22, 2024

This is a very welcome addition. I've been watching from the peanut gallery for the longest time, waiting for something like this. Thanks a lot for taking the time, I know how hard writing documentation is. <3

@PoignardAzur
Copy link
Contributor Author

Thanks a lot for taking the time, I know how hard writing documentation is. <3

It's so much harder than it sounds.

You have to put your brain in a certain mode and pull things from it that it really doesn't want to give you by default.

@PoignardAzur PoignardAzur added this pull request to the merge queue Oct 22, 2024
Merged via the queue into main with commit e03dfdd Oct 22, 2024
17 checks passed
@PoignardAzur PoignardAzur deleted the doc_masonry_1 branch October 22, 2024 13:55
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.

Add tutorial to documentation
4 participants