Skip to content

Commit cf09ff1

Browse files
Update and rename helperAnnotation.md to helper_annotation.md
1 parent a968fe4 commit cf09ff1

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

docs/helperAnnotation.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/helper_annotation.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Help Annotation
2+
The //% helper annotation links an exported function to a runtime helper in a namespace,
3+
so calls to the exported function are replaced with the helper’s implementation at compile time.
4+
5+
## Dealing with Help
6+
1. Make sure you first write `github:`, so MakeCode knows to fetch a repository on GitHub
7+
2. Write the repository's name **without any spaces after writing the colon**
8+
3. Add a slash command to tell the compiler to read a specific file in the repository
9+
4. If it is a folder in a repository, write the folder's name and then another slash command
10+
5. Finally, add the file's name (**the file's path must be right or it will not be load**)
11+
6. Also, make sure to **not** add .md in the end of the file path because MakeCode already reads doc files as markdown files.
12+
13+
Here is a snippet showing how to use the helper annotation correctly.
14+
``` ts
15+
//% help=github:pxt-hardware-programming-docs/docs/_getFactoryInstance
16+
function _getFactoryInstance() { }
17+
_getFactoryInstance()
18+
```

0 commit comments

Comments
 (0)