Skip to content

Commit 6260475

Browse files
committed
Apply doc.
1 parent f0e8926 commit 6260475

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,32 @@ string base on the `search-string` information. Then this is the result.
100100

101101
## Before/After Insertion
102102

103-
You can customize document before you actually insert anything.
103+
You can customize document before or after the document string insertion.
104+
There are total two hooks you can customize.
105+
106+
* `docstr-before-insert-hook`
107+
* `docstr-after-insert-hook`
108+
109+
The usage of this is to customize the document string with set up. For instance,
110+
some programming languages would add `@desc` before an actual description. Do
111+
the following can implement this.
112+
113+
```el
114+
(add-hook 'docstr-before-insert-hook (lambda (search-string) (insert "@desc ")))
115+
```
116+
117+
Of course, I would recommend you add it locally so it is language specific
118+
document style. Let's try apply to language `TypeScript` only within
119+
`typescript-mode`.
120+
121+
```el
122+
(defun my-typescript-mode-hook ()
123+
(add-hook 'docstr-before-insert-hook
124+
(lambda (search-string) (insert "@desc "))
125+
nil t))
126+
127+
(add-hook 'typescript-mode-hook #'my-typescript-mode-hook)
128+
```
104129

105130
## Configure Faces
106131

0 commit comments

Comments
 (0)