You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/apiview/parsers/CONTRIBUTING.md
+23-17Lines changed: 23 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ The main idea is to capture the hierachy of the API using a tree data structure,
8
8
9
9

10
10
11
-
Each tree node has top tokens which should be used to capture the main data on the node. If your language requires it use the bottom tokens to capture data that closes out the node.
11
+
Each tree node has top tokens which should be used to capture the main tokens on the node. If your language requires it use the bottom tokens to capture tokens that closes out the node.
12
12
13
13
- Here are the models needed
14
14
```
@@ -26,6 +26,7 @@ Each tree node has top tokens which should be used to capture the main data on t
26
26
string Value
27
27
string Id
28
28
StructuredTokenKind Kind
29
+
Set<string> Tags
29
30
Dictionary<string, string> Properties
30
31
Set<string> RenderClasses
31
32
@@ -38,39 +39,44 @@ Each tree node has top tokens which should be used to capture the main data on t
38
39
Url
39
40
```
40
41
### APITreeNode
41
-
-`Name` : The name of the tree node which will be used for page navigation.
42
-
-`Id` : Id of the node, which should be unique at the node level. i.e. unique among its siblings. Also the id should be [valid HTML id](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
42
+
-`Name` : The name of the tree node which will be used for API navigation.
43
+
-`Id` : Id of the node, which should be unique at the node level. i.e. unique among its siblings
43
44
-`Kind` : What kind of node is it. (namespace, class, module, method e.t.c)
44
-
-`Tags` : Use this for thigs like `Deprecated`, `Hidden`
45
-
-`Properties` : If the node needs more specification e.g. Use `SubKind` entry to make the node kind more specific. Feel free to push any other data that you think will be useful here, then file an issue for further implementation in APIView.
45
+
-`Tags` : Use this for opt in or opt out boolean properties e.g. `Deprecated`, `Hidden`, `HideFromNavigation`
46
+
-`Properties` : Use this for other properties of the node. If the node needs more specification e.g. Use `SubKind` entry to make the node kind more specific.
46
47
-`TopTokens` : The main data of the node.
47
48
-`BottomToken` : Data that closes out the node.
48
-
-`Childrens` : Node immediate descendant
49
+
-`Children` : Node immediate descendant
49
50
50
51
### StructuredToken
51
52
-`Value` : The token value which will be dispalyed.
52
-
-`Id` : which will be used to navigate and find token on page.
53
-
-`Kind` : Could be `LineBreak``NoneBreakingSpace``TabSpace``ParameterSeparator``Url``Content`
54
-
All tokens should be content except for spacing tokens. ParameterSeparator should be used between method or function parameters. Spacing token dont need to have value.
55
-
-`Properties` : Capture any other interesting data here. e.g Use `GroupId` : `documentation` to group consecutive tokens.
56
-
-`RenderClasses` : Add css classes for how the tokens will be rendred.
53
+
-`Id` : Which will be used to navigate and find token on page.
54
+
-`Kind` : Could be `Content``LineBreak``NoneBreakingSpace``TabSpace``ParameterSeparator``Url`
55
+
All tokens should be content except for spacing tokens and url. ParameterSeparator should be used between method or function parameters. Spacing token dont need to have value.
56
+
-`Tags` : Use this for opt in or opt out boolean properties e.g. `SkippDiff`
57
+
-`Properties` : Capture any other interesting data here. e.g Use `GroupId` : `documentation` to group consecutive comment tokens.
58
+
-`RenderClasses` : Add css classes for how the tokens will be rendred. Classes currently being used are `text``keyword``punctuation``type-name``member-name``literal``string-literal``comment` Feel free to add your own custom class. Whatever custom classes you use please provide us the appriopriate css for the class so we can update APIView.
59
+
60
+
Each module of the API (namespace, class, method) should be its own node.
57
61
58
62
If you want to have space between the API nodes add an empty token and lineBreak at the end of bottom tokens to simulate one empty line.
59
63
60
64
Dont worry about indentation that will be handeled by the tree structure, unless you want to have indentation between the tokens then use `TabSpace` token kind.
61
65
62
-
If your packages contains multiple languages then you will have multiple trees with multiple roots.
66
+
If your packages contains multiple assemblies then you will have multiple trees with multiple roots.
63
67
Assign the final parsed value to `APIForest` property of the `CodeFile`.
64
68
65
-
## Commons Scenarios
69
+
Serialize the generated code file to JSON `.json` and MessagePack `.msgpack`. MessagePack will be used by APIView as it has way better download / deserilization performance. We will revert to JSON if you don`t provide MessagePack.
70
+
71
+
## How to handle commons Scenarios
66
72
- TEXT, KEYWORD, COMMENT : Add `text`, `keyword`, `comment` to RenderClasses of the token
67
73
- NEW_LINE : Create a token with `Kind = LineBreak`
68
74
- WHITE_SPACE : Create token with `Kind = NoneBreakingSpace`
69
75
- PUNCTUATION : Create a token with `Kind = Content` and the `Value = the punctuation`
70
76
- DOCUMENTATION : Add `GroupId = documentation` in the properties of the token. This identifies a range of consecutive tokens as belonging to a group.
71
-
- SKIP_DIFF : Add `SkipDiff` to the node Tag to indicate that diff should be skipped.
72
-
- LINE_ID_MARKER : You can add a empty token. `Kind = Content` and `Value = Empty String` then give it an Id to make it commentable.
77
+
- SKIP_DIFF : Add `SkipDiff` to the Tag to indicate that node or token should not be included in diff computation
78
+
- LINE_ID_MARKER : You can add a empty token. `Kind = Content` and `Value = ""` then give it an `Id` to make it commentable.
73
79
- EXTERNAL_LINK : Create a single token set `Kind = Url`, `Value = link` then add the link text as a properties `LinkText`;
74
-
- Common Tags: `Deprecated`, `Hidden`, `HideFromNavigation`
75
-
80
+
- Common Tags: `Deprecated`, `Hidden`, `HideFromNavigation`, `SkipDiff`
76
81
82
+
Please reach out at [APIView Teams Channel](https://teams.microsoft.com/l/channel/19%3A3adeba4aa1164f1c889e148b1b3e3ddd%40thread.skype/APIView?groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47) if you need more infomation.
0 commit comments