-
Notifications
You must be signed in to change notification settings - Fork 250
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
[SuperEditor][Web][Guides]: Updates guides for version 0.3.0 (#2429) #2430
base: main
Are you sure you want to change the base?
Changes from 8 commits
0e6190b
9afb447
7a74a5a
59a161c
1e759df
1ca37a6
a22358b
31a8ef1
435f7e5
8cb102a
b349912
30f0115
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,27 @@ dependencies: | |
De-serialize a Markdown `String` with the supplied top-level function. | ||
|
||
```dart | ||
const markdown = ''' | ||
# Header | ||
This is a _Super_ Editor! | ||
'''; | ||
|
||
final document = deserializeMarkdownToDocument(markdown); | ||
``` | ||
|
||
The de-serialized document is a `MutableDocument`. Check other guides to find out how to use it. | ||
The de-serialized document is a `MutableDocument`. Add it to your `Editor` similarly to how you did it in the Quickstart guide: | ||
|
||
```dart | ||
_editor = createDefaultDocumentEditor( | ||
document: document, | ||
composer: MutableDocumentComposer(), | ||
); | ||
``` | ||
|
||
Run that, and you'll see the document rendered on the screen. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All code is intended to be run, so instructing the reader to run code doesn't add anything. Additionally, if the user does run the code in the sample, the user won't see anything. So this statement isn't accurate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if you noticed that I had added the block:
I did that so that this guide would work more like a tutorial and running the code would produce a visible result. The code in some of the other guides don't run as written. For example, Also, the current Quickstart guide that is live now says "Run your app, tap in the editor, and start typing!" I was following this tutorial style pattern. Is your intention for most of the guides that they should just be code snippets rather than tutorials? |
||
|
||
## Serialize Markdown | ||
Serialize a `Document` to a Markdown `String`. | ||
You can also go the other direction. Here's how you would serialize a `Document` to a Markdown `String`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid implying knowledge about orders of sections. At any time we might choose to re-order sections, add sections, or remove sections. A section is meant to describe an isolated concern, so it shouldn't be difficult to avoid referencing things that come before or after. In this case, it doesn't look like any additional information was conveyed by the addition of words. If you feel that the existing sentence doesn't provide enough context, then you could elaborate on context. But if the existing sentence actually communicates all relevant info, then it probably doesn't need to change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I misunderstood the original intent in updating the guides from a new user's perspective. I was updating them as if I were working through the guides as a new user reading them in the order they appear in the menu and reading each guide from top to bottom. I see now that that was not your intention. |
||
|
||
```dart | ||
final markdown = serializeDocumentToMarkdown(document); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the term "add" is misleading. That makes it sound like some "extra" thing you tack on to an
Editor
. ADocument
is a foundational requirement for anEditor
.I think if you want to point people to the
Quickstart
guide, then we should just do that and not recreate the example code. On the other hand, if you think the example code is needed, then I don't think we need to reference the Quickstart guide. Or at least we don't need to reference it up here above the example.Here's another version of this part of the guide based on my thinking above:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since people presumably just finished reading the Quickstart guide, my thinking is that we don't need to re-explain what a
MutableDocument
is. I thought having a quick refresher on where to use thedocument
object would be helpful, though.I take your point about the "add" word, and including a link is a good idea.
But if you would prefer to remove the code block or add the extended explanation, I can do that.