File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,35 @@ It's also necessary to add a `type="text/language-name"` or `lang="language-name
43
43
</style >
44
44
```
45
45
46
+ ## Documenting components
47
+
48
+ To add documentation on a Svelte component that will show up as a docstring in
49
+ LSP-compatible editors, you can use an HTML comment with the ` @component ` tag:
50
+
51
+ ``` html
52
+ <!--
53
+ @component
54
+ Here's some documentation for this component. It will show up on hover for
55
+ JavaScript/TypeScript projects using a LSP-compatible editor such as VSCode or
56
+ Vim/Neovim with coc.nvim.
57
+
58
+ - You can use markdown here.
59
+ - You can use code blocks here.
60
+ - JSDoc/TSDoc will be respected by LSP-compatible editors.
61
+ - Indentation will be respected as much as possible.
62
+ -->
63
+
64
+ <!-- @component You can use a single line, too -->
65
+
66
+ <!-- @component But only the last documentation comment will be used -->
67
+
68
+ <main >
69
+ <h1 >
70
+ Hello world
71
+ </h1 >
72
+ </main >
73
+ ```
74
+
46
75
## Troubleshooting / FAQ
47
76
48
77
### Using TypeScript? See [ this section] ( ./preprocessors/typescript.md#troubleshooting--faq )
You can’t perform that action at this time.
0 commit comments