Skip to content

Commit bff8415

Browse files
committed
Supply doc.
1 parent 43cbf12 commit bff8415

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,37 @@ that takes in one argument. For instance,
6464
```
6565

6666
Argument `search-string` will be populated by the triggeration associated list.
67-
See variable `docstr-trigger-alist` for more information.
67+
See variable `docstr-trigger-alist` for more information. For instance,
68+
a `C#` trigger data is like this
6869

70+
```el
71+
(csharp-mode . ("/" docstr-trigger-csharp))
72+
```
73+
74+
And the triggeration function will look like this
75+
76+
```el
77+
(defun docstr-trigger-csharp (&rest _)
78+
"Trigger document string inside C#."
79+
(when (and (docstr--doc-valid-p) (looking-back "///" 3))
80+
(save-excursion
81+
(insert " <summary>\n")
82+
(insert "/// \n")
83+
(insert "/// </summary>"))
84+
(forward-line 1)
85+
(end-of-line)
86+
(docstr--insert-doc-string (docstr--c-style-search-string 2))))
87+
```
88+
89+
The document string is triggered by certain conditions are met; and it will
90+
finally calls the function `docstr--insert-doc-string` for document string
91+
insertion. In this example, `(docstr--c-style-search-string 2)` is the
92+
`search-string` ready for document string writer to write a proper document
93+
string base on the `search-string` information.
6994

70-
The document string is triggered by certain conditions are met.
95+
<p align="center">
96+
<img src="./etc/csharp-vs-doc-demo.gif"/>
97+
</p>
7198

7299
## Configure Faces
73100

0 commit comments

Comments
 (0)