forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
site: add FAQ entry for how to document a svelte component (sveltejs#…
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
question: How do I document my components? | ||
--- | ||
|
||
In editors which use the Svelte Language Server you can document Components, functions and exports using specially formatted comments. | ||
|
||
````svelte | ||
<script> | ||
/** What should we call the user? */ | ||
export let name = 'world'; | ||
</script> | ||
<!-- | ||
@component | ||
Here's some documentation for this component. | ||
It will show up on hover. | ||
- You can use markdown here. | ||
- You can also use code blocks here. | ||
- Usage: | ||
```tsx | ||
<main name="Arethra"> | ||
``` | ||
--> | ||
<main> | ||
<h1> | ||
Hello, {name} | ||
</h1> | ||
</main> | ||
```` | ||
|
||
Note: The `@component` is necessary in the HTML comment which describes your component. |