@cparra/apexdocs 2.5.1 → 2.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -13
- package/docs/Main/SampleClass.md +9 -3
- package/docs/README.md +15 -2
- package/docs/core-utils/ClassWithDescriptionBlock.md +36 -0
- package/examples/force-app/main/default/classes/ClassWithDescriptionBlock.cls +31 -0
- package/lib/cli/generate.js +9 -0
- package/lib/cli/generate.js.map +1 -1
- package/lib/model/file.js +4 -2
- package/lib/model/file.js.map +1 -1
- package/lib/model/markdown-file.js +2 -2
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.js +4 -2
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-home-file.js +6 -2
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/settings.d.ts +3 -0
- package/lib/settings.js +6 -0
- package/lib/settings.js.map +1 -1
- package/lib/util/truncate.d.ts +1 -0
- package/lib/util/truncate.js +8 -0
- package/lib/util/truncate.js.map +1 -0
- package/package.json +1 -1
- package/src/cli/generate.ts +10 -0
- package/src/model/file.ts +4 -2
- package/src/model/markdown-file.ts +3 -2
- package/src/model/markdown-generation-util/type-declaration-util.ts +4 -2
- package/src/model/markdown-home-file.ts +9 -1
- package/src/settings.ts +10 -0
- package/src/util/truncate.ts +3 -0
package/README.md
CHANGED
|
@@ -75,7 +75,8 @@ public class MyClass {
|
|
|
75
75
|
|
|
76
76
|
### Demo
|
|
77
77
|
|
|
78
|
-
ApexDocs currently supports generating markdown files for Jekyll and Docsify sites, as well as generating plain markdown
|
|
78
|
+
ApexDocs currently supports generating markdown files for Jekyll and Docsify sites, as well as generating plain markdown
|
|
79
|
+
files.
|
|
79
80
|
|
|
80
81
|
### In the wild
|
|
81
82
|
|
|
@@ -114,16 +115,16 @@ apexdocs-generate
|
|
|
114
115
|
|
|
115
116
|
The CLI supports the following parameters:
|
|
116
117
|
|
|
117
|
-
| Parameter | Alias | Description
|
|
118
|
-
|
|
119
|
-
| --sourceDir | -s | The directory location which contains your apex .cls classes.
|
|
120
|
-
| --targetDir | -t | The directory location where documentation will be generated to.
|
|
121
|
-
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided.
|
|
122
|
-
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private
|
|
123
|
-
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports: `jekyll`, `docsify`, and `plain-markdown`.
|
|
124
|
-
| --indexOnly | N/A | Defines whether only the index file should be generated.
|
|
125
|
-
| --defaultGroupName | N/A | Defines the `@group` name to be used when a file does not specify it.
|
|
126
|
-
|
|
118
|
+
| Parameter | Alias | Description | Default | Required |
|
|
119
|
+
|--------------------|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|----------|
|
|
120
|
+
| --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
|
|
121
|
+
| --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
|
|
122
|
+
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
|
|
123
|
+
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private | `global` | No |
|
|
124
|
+
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports: `jekyll`, `docsify`, and `plain-markdown`. | `jekyll` | No |
|
|
125
|
+
| --indexOnly | N/A | Defines whether only the index file should be generated. | `false` | No |
|
|
126
|
+
| --defaultGroupName | N/A | Defines the `@group` name to be used when a file does not specify it. | `Miscellaneous` | No |
|
|
127
|
+
| --sanitizeHtml | N/A | When on, any special character within your ApexDocs is converted into its HTML code representation. This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" because otherwise the content within < and > would be treated as HTML tags and not shown in the output. Content in @example blocks are never sanitized. | true | No |
|
|
127
128
|
|
|
128
129
|
### Importing to your project
|
|
129
130
|
|
|
@@ -284,10 +285,11 @@ Email addresses can also be inlined linked by using the `{@email EMAIL_ADDRESS}`
|
|
|
284
285
|
|
|
285
286
|
### HTML support
|
|
286
287
|
|
|
287
|
-
For the most part all HTML is sanitized
|
|
288
|
+
For the most part all HTML is sanitized when the `--sanitizeHtml` flag is passed a true value (which is the default).
|
|
289
|
+
But there are some tags are allowed to have for the possibility of better
|
|
288
290
|
styling long text.
|
|
289
291
|
|
|
290
|
-
- Allowed tags are: `br`, `p`, `ul`, and `
|
|
292
|
+
- Allowed tags are: `br`, `p`, `ul`, `li`, and `code`
|
|
291
293
|
|
|
292
294
|
Example
|
|
293
295
|
|
|
@@ -304,6 +306,22 @@ class MyClass {
|
|
|
304
306
|
}
|
|
305
307
|
```
|
|
306
308
|
|
|
309
|
+
⚠️When the `--sanitizeHtml` flag is ON, any special character between code blocks (i.e. \```, \`, or `<code>`) will also be escaped.
|
|
310
|
+
So if you have references to Apex generic collections (Set, List, or Maps) they will not look right, as the < and > symbols will be escaped.
|
|
311
|
+
To prevent this you can turn the flag off, but be aware of the special considerations when doing this described below.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
For full control over the output you can also turn off the `--sanitizeHtml` flag, which will allow you
|
|
316
|
+
to have any desired HTML within your docs.
|
|
317
|
+
|
|
318
|
+
⚠️When the `--sanitizeHtml` flag is OFF, references to Apex generic collections (Set, List or Maps) can be problematic
|
|
319
|
+
as they will be treated as an HTML tag and not displayed. For example if you have something like `@description Returns a List<String>`
|
|
320
|
+
the `<String>` portion will be treated as HTML and thus not appear on the page.
|
|
321
|
+
|
|
322
|
+
To fix this issue, when not sanitizing HTML, you should wrap any code that contain special characters that can be treated as HTML within '`'
|
|
323
|
+
or within `<code>` tags.
|
|
324
|
+
|
|
307
325
|
## Typescript
|
|
308
326
|
|
|
309
327
|
ApexDocs provides all necessary type definitions.
|
|
@@ -311,4 +329,5 @@ ApexDocs provides all necessary type definitions.
|
|
|
311
329
|
---
|
|
312
330
|
|
|
313
331
|
## 1.X
|
|
332
|
+
|
|
314
333
|
Looking for documentation for version 1.X? Please refer to its [branch](https://github.com/cesarParra/apexdocs/tree/1.x)
|
package/docs/Main/SampleClass.md
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
`STATUS: ACTIVE`
|
|
8
8
|
|
|
9
|
-
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
9
|
+
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
10
|
+
But this [ClassThatDoesNotExist](ClassThatDoesNotExist) does not exist.
|
|
11
|
+
You can also link using this syntax [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
**Group** Main
|
|
@@ -41,11 +43,13 @@ Constructs a SampleClass without any arguments. This relates to [SampleInterface
|
|
|
41
43
|
**See** [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
42
44
|
|
|
43
45
|
###### Example
|
|
44
|
-
```
|
|
46
|
+
```
|
|
47
|
+
apex
|
|
45
48
|
// Example
|
|
46
49
|
SampleClass sampleInstance = new SampleClass();
|
|
47
50
|
```
|
|
48
51
|
|
|
52
|
+
|
|
49
53
|
---
|
|
50
54
|
### Other
|
|
51
55
|
##### `SampleClass(String argument1, String argument2)`
|
|
@@ -116,11 +120,13 @@ String
|
|
|
116
120
|
Empty string
|
|
117
121
|
|
|
118
122
|
#### Example
|
|
119
|
-
```
|
|
123
|
+
```
|
|
124
|
+
apex
|
|
120
125
|
String result = SampleClass.testMethod();
|
|
121
126
|
System.debug(result);
|
|
122
127
|
```
|
|
123
128
|
|
|
129
|
+
|
|
124
130
|
### `static anotherSampleMethod(String arg1)`
|
|
125
131
|
|
|
126
132
|
Something here
|
package/docs/README.md
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
# Classes
|
|
2
|
+
## core-utils
|
|
3
|
+
|
|
4
|
+
### [ClassWithDescriptionBlock](/core-utils/ClassWithDescriptionBlock.md)
|
|
5
|
+
|
|
6
|
+
Simple Trigger Framework, integrated with [CodeControl](CodeControl).
|
|
7
|
+
To use TriggerService for a given trigger,
|
|
8
|
+
1. Build a trigger handler class that extends [TriggerHelperBase](TriggerHelperBase), implementing any trigger stages (e.g., beforeInsert, afterUpdate, etc)
|
|
9
|
+
needed by your trigger. Here is a List<String>.
|
|
10
|
+
2. In t…
|
|
2
11
|
## Main
|
|
3
12
|
|
|
4
13
|
### [GroupedClass](/Main/GroupedClass.md)
|
|
5
14
|
|
|
6
15
|
Uses a block style apex doc
|
|
7
16
|
|
|
17
|
+
|
|
8
18
|
### [SampleClass](/Main/SampleClass.md)
|
|
9
19
|
|
|
10
|
-
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
20
|
+
This is a class description. This class relates to [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
21
|
+
But this [ClassThatDoesNotExist](ClassThatDoesNotExist) does not exist.
|
|
22
|
+
You can also link using this syntax [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
23
|
+
|
|
11
24
|
## Miscellaneous
|
|
12
25
|
|
|
13
26
|
### [SampleClassWithoutModifier](/API/SampleClassWithoutModifier.md)
|
|
14
27
|
|
|
15
|
-
|
|
16
28
|
## Sample Interfaces
|
|
17
29
|
|
|
18
30
|
### [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
19
31
|
|
|
20
32
|
This is an interface description.
|
|
33
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ClassWithDescriptionBlock
|
|
2
|
+
|
|
3
|
+
Simple Trigger Framework, integrated with [CodeControl](CodeControl).
|
|
4
|
+
To use TriggerService for a given trigger,
|
|
5
|
+
1. Build a trigger handler class that extends [TriggerHelperBase](TriggerHelperBase), implementing any trigger stages (e.g., beforeInsert, afterUpdate, etc)
|
|
6
|
+
needed by your trigger. Here is a List<String>.
|
|
7
|
+
2. In the trigger, call `TriggerService.run()`, passing a new instance of your handler.
|
|
8
|
+
```
|
|
9
|
+
// TriggerHandler
|
|
10
|
+
public class AccountHandler extends TriggerHelperBase {
|
|
11
|
+
public override void afterInsert(List<SObject> newList) {
|
|
12
|
+
// ... do trigger things
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// Trigger
|
|
16
|
+
trigger AccountTrigger on Account (after insert) {
|
|
17
|
+
TriggerService.run(new AccountHandler());
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
Something else `<but>` outside.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
**Class** TriggerService
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
**TestClass** TriggerService_Test
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
**Group** core-utils
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
**Author** Jason Clark
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
**Date** 1/15/22
|
|
36
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**********************************************************
|
|
2
|
+
@class TriggerService
|
|
3
|
+
@testClass TriggerService_Test
|
|
4
|
+
@group core-utils
|
|
5
|
+
@description Simple Trigger Framework, integrated with <<CodeControl>>.
|
|
6
|
+
|
|
7
|
+
To use TriggerService for a given trigger,
|
|
8
|
+
1. Build a trigger handler class that extends <<TriggerHelperBase>>, implementing any trigger stages (e.g., beforeInsert, afterUpdate, etc)
|
|
9
|
+
needed by your trigger. Here is a List<String>.
|
|
10
|
+
2. In the trigger, call `TriggerService.run()`, passing a new instance of your handler.
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
// TriggerHandler
|
|
14
|
+
public class AccountHandler extends TriggerHelperBase {
|
|
15
|
+
public override void afterInsert(List<SObject> newList) {
|
|
16
|
+
// ... do trigger things
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Trigger
|
|
21
|
+
trigger AccountTrigger on Account (after insert) {
|
|
22
|
+
TriggerService.run(new AccountHandler());
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Something else `<but>` outside.
|
|
27
|
+
|
|
28
|
+
@author Jason Clark
|
|
29
|
+
@date 1/15/22
|
|
30
|
+
***********************************************************/
|
|
31
|
+
public class ClassWithDescriptionBlock {}
|
package/lib/cli/generate.js
CHANGED
|
@@ -47,6 +47,14 @@ const argv = yargs.options({
|
|
|
47
47
|
default: 'Miscellaneous',
|
|
48
48
|
describe: 'Defines the @group name to be used when a file does not specify it.',
|
|
49
49
|
},
|
|
50
|
+
sanitizeHtml: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
default: true,
|
|
53
|
+
describe: 'When on, any special character within your ApexDocs is converted into its HTML code representation. ' +
|
|
54
|
+
'This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" ' +
|
|
55
|
+
'because otherwise the content within < and > would be treated as HTML tags and not shown in the output. ' +
|
|
56
|
+
'Content in @example blocks are never sanitized.',
|
|
57
|
+
},
|
|
50
58
|
}).argv;
|
|
51
59
|
settings_1.Settings.build({
|
|
52
60
|
sourceDirectory: argv.sourceDir,
|
|
@@ -56,6 +64,7 @@ settings_1.Settings.build({
|
|
|
56
64
|
targetGenerator: argv.targetGenerator,
|
|
57
65
|
indexOnly: argv.indexOnly,
|
|
58
66
|
defaultGroupName: argv.defaultGroupName,
|
|
67
|
+
sanitizeHtml: argv.sanitizeHtml,
|
|
59
68
|
});
|
|
60
69
|
Apexdocs_1.Apexdocs.generate();
|
|
61
70
|
//# sourceMappingURL=generate.js.map
|
package/lib/cli/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAE/B,0CAAyD;AACzD,sDAAmD;AAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,SAAS,EAAE;QACT,IAAI,EAA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AC,SAAS;IAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;IACzB,KAAK,EAAE,IAAI,CAAC,KAAK;IACjB,SAAS,EAAE,IAAI,CAAC,SAAS;IACzB,eAAe,EAAE,IAAI,CAAC,eAAmC;IACzD,SAAS,EAAE,IAAI,CAAC,SAAS;IACzB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;IACvC,YAAY,EAAE,IAAI,CAAC,YAAY;CAChC,CAAC,CAAC;AAEH,mBAAQ,CAAC,QAAQ,EAAE,CAAC"}
|
package/lib/model/file.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.File = void 0;
|
|
4
4
|
const xss = require("xss");
|
|
5
|
+
const settings_1 = require("../settings");
|
|
5
6
|
const xssFilter = new xss.FilterXSS({
|
|
6
|
-
whiteList: { br: [], p: [], ul: [], li: [] },
|
|
7
|
+
whiteList: { br: [], p: [], ul: [], li: [], code: [], pre: [] },
|
|
7
8
|
});
|
|
8
9
|
class File {
|
|
9
10
|
constructor(fileName, dir) {
|
|
@@ -15,7 +16,8 @@ class File {
|
|
|
15
16
|
return this._contents;
|
|
16
17
|
}
|
|
17
18
|
addText(text, encodeHtml = true) {
|
|
18
|
-
const
|
|
19
|
+
const shouldEncode = encodeHtml && settings_1.Settings.getInstance().sanitizeHtml;
|
|
20
|
+
const textToAdd = shouldEncode ? xssFilter.process(text) : text;
|
|
19
21
|
this._contents += textToAdd;
|
|
20
22
|
this.addBlankLine();
|
|
21
23
|
}
|
package/lib/model/file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/model/file.ts"],"names":[],"mappings":";;;AAAA,2BAA4B;
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/model/file.ts"],"names":[],"mappings":";;;AAAA,2BAA4B;AAC5B,0CAAuC;AAEvC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC;IAClC,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;CAChE,CAAC,CAAC;AAEH,MAAsB,IAAI;IAGxB,YAAmB,QAAgB,EAAS,GAAW;QAApC,aAAQ,GAAR,QAAQ,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAFvD,cAAS,GAAG,EAAE,CAAC;IAE2C,CAAC;IAI3D,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,OAAO,CAAC,IAAY,EAAE,UAAU,GAAG,IAAI;QACrC,MAAM,YAAY,GAAG,UAAU,IAAI,mBAAQ,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC;QACvE,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,YAAY;QACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC;IACzB,CAAC;CACF;AArBD,oBAqBC"}
|
|
@@ -23,13 +23,13 @@ class MarkdownFile extends file_1.File {
|
|
|
23
23
|
super.addText(text, encodeHtml);
|
|
24
24
|
}
|
|
25
25
|
startCodeBlock() {
|
|
26
|
-
this.
|
|
26
|
+
this.addText('```');
|
|
27
27
|
const sourceLanguage = 'apex';
|
|
28
28
|
this._contents += sourceLanguage;
|
|
29
29
|
this.addBlankLine();
|
|
30
30
|
}
|
|
31
31
|
endCodeBlock() {
|
|
32
|
-
this.
|
|
32
|
+
this.addText('```');
|
|
33
33
|
this.addBlankLine();
|
|
34
34
|
}
|
|
35
35
|
addHorizontalRule() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file.js","sourceRoot":"","sources":["../../src/model/markdown-file.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,kGAAyF;AAEzF,MAAa,YAAa,SAAQ,WAAI;IACpC,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QAC9B,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,KAAK,IAAI,GAAG,CAAC;SACd;QAED,KAAK,IAAI,GAAG,CAAC;QACb,KAAK,IAAI,IAAI,CAAC;QACd,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAEM,OAAO,CAAC,IAAY,EAAE,UAAU,GAAG,IAAI;QAC5C,IAAI,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,GAAG,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-file.js","sourceRoot":"","sources":["../../src/model/markdown-file.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,kGAAyF;AAEzF,MAAa,YAAa,SAAQ,WAAI;IACpC,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QAC9B,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,KAAK,IAAI,GAAG,CAAC;SACd;QAED,KAAK,IAAI,GAAG,CAAC;QACb,KAAK,IAAI,IAAI,CAAC;QACd,IAAI,CAAC,SAAS,IAAI,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AE,oCAAwB,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvG;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAES,MAAM,CAAC,mBAAmB,CAAC,IAAY;QAC/C,+CAA+C;QAC/C,MAAM,eAAe,GAAG,gBAAgB,CAAC;QACzC,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACrD,IAAI,KAAK,CAAC;QACV,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,GAAG;YACD,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9B,IAAI,KAAK,EAAE;gBACT,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrB;SACF,QAAQ,KAAK,EAAE;QAEhB,KAAK,MAAM,YAAY,IAAI,OAAO,EAAE;YAClC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SACzF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjHD,oCAiHC"}
|
|
@@ -8,9 +8,11 @@ function declareType(markdownFile, typeMirror) {
|
|
|
8
8
|
markdownFile.addBlankLine();
|
|
9
9
|
markdownFile.addText(`\`${currentAnnotation.type.toUpperCase()}\``);
|
|
10
10
|
});
|
|
11
|
-
if ((_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.
|
|
11
|
+
if ((_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.descriptionLines) {
|
|
12
12
|
markdownFile.addBlankLine();
|
|
13
|
-
|
|
13
|
+
for (const currentLine of typeMirror.docComment.descriptionLines) {
|
|
14
|
+
markdownFile.addText(currentLine);
|
|
15
|
+
}
|
|
14
16
|
markdownFile.addBlankLine();
|
|
15
17
|
}
|
|
16
18
|
doc_comment_annotation_util_1.addCustomDocCommentAnnotations(markdownFile, typeMirror);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAG/E,SAAgB,WAAW,CAAC,YAA0B,EAAE,UAAgB;;IACtE,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,iBAA6B,EAAE,EAAE;QAC/D,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,UAAI,UAAU,CAAC,UAAU,0CAAE,
|
|
1
|
+
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAG/E,SAAgB,WAAW,CAAC,YAA0B,EAAE,UAAgB;;IACtE,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,iBAA6B,EAAE,EAAE;QAC/D,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,UAAI,UAAU,CAAC,UAAU,0CAAE,gBAAgB,EAAE;QAC3C,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,KAAK,MAAM,WAAW,IAAI,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAChE,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACnC;QACD,YAAY,CAAC,YAAY,EAAE,CAAC;KAC7B;IAED,4DAA8B,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAfD,kCAeC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MarkdownHomeFile = void 0;
|
|
4
4
|
const class_file_generatorHelper_1 = require("../transpiler/markdown/class-file-generatorHelper");
|
|
5
5
|
const markdown_file_1 = require("./markdown-file");
|
|
6
|
+
const truncate_1 = require("../util/truncate");
|
|
6
7
|
class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
7
8
|
constructor(fileName, types, headerContent) {
|
|
8
9
|
super(fileName, '');
|
|
@@ -24,11 +25,14 @@ class MarkdownHomeFile extends markdown_file_1.MarkdownFile {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
addTypeEntry(typeMirror) {
|
|
27
|
-
var _a
|
|
28
|
+
var _a;
|
|
28
29
|
this.addBlankLine();
|
|
29
30
|
this.addTitle(class_file_generatorHelper_1.default.getFileLink(typeMirror), 3);
|
|
30
31
|
this.addBlankLine();
|
|
31
|
-
|
|
32
|
+
if ((_a = typeMirror.docComment) === null || _a === void 0 ? void 0 : _a.descriptionLines) {
|
|
33
|
+
const description = typeMirror.docComment.descriptionLines.reduce((previous, current) => previous + current + '\n', '');
|
|
34
|
+
this.addText(truncate_1.truncate(description, 300));
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
group(classes) {
|
|
34
38
|
return classes.reduce((groups, currentClass) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-home-file.js","sourceRoot":"","sources":["../../src/model/markdown-home-file.ts"],"names":[],"mappings":";;;AACA,kGAAyF;AACzF,mDAA+C;
|
|
1
|
+
{"version":3,"file":"markdown-home-file.js","sourceRoot":"","sources":["../../src/model/markdown-home-file.ts"],"names":[],"mappings":";;;AACA,kGAAyF;AACzF,mDAA+C;AAC/C,+CAA4C;AAE5C,MAAa,gBAAiB,SAAQ,4BAAY;IAChD,YAAmB,QAAgB,EAAS,KAAa,EAAE,aAAsB;QAC/E,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAD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AAY,EAAE,EAAE;YAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YAC7C,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IAChB,CAAC;IAEO,aAAa,CAAC,UAAgB;;QACpC,OAAO,mBACL,UAAU,CAAC,UAAU,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,2CAAG,IAAI,mCAAI,eAAe,CAC9G,CAAC;IACJ,CAAC;CACF;AAjDD,4CAiDC"}
|
package/lib/settings.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface SettingsConfig {
|
|
|
8
8
|
targetGenerator: GeneratorChoices;
|
|
9
9
|
indexOnly: boolean;
|
|
10
10
|
defaultGroupName: string;
|
|
11
|
+
sanitizeHtml: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare class Settings {
|
|
13
14
|
config: SettingsConfig;
|
|
@@ -22,5 +23,7 @@ export declare class Settings {
|
|
|
22
23
|
private static typeTranspilerCache?;
|
|
23
24
|
get typeTranspiler(): ProcessorTypeTranspiler;
|
|
24
25
|
get indexOnly(): boolean;
|
|
26
|
+
get sanitizeHtml(): boolean;
|
|
27
|
+
get numberOfVisibleDescriptionLinesOnHomePage(): number;
|
|
25
28
|
getDefaultGroupName(): string;
|
|
26
29
|
}
|
package/lib/settings.js
CHANGED
|
@@ -50,6 +50,12 @@ class Settings {
|
|
|
50
50
|
get indexOnly() {
|
|
51
51
|
return this.config.indexOnly;
|
|
52
52
|
}
|
|
53
|
+
get sanitizeHtml() {
|
|
54
|
+
return this.config.sanitizeHtml;
|
|
55
|
+
}
|
|
56
|
+
get numberOfVisibleDescriptionLinesOnHomePage() {
|
|
57
|
+
return 5;
|
|
58
|
+
}
|
|
53
59
|
getDefaultGroupName() {
|
|
54
60
|
return this.config.defaultGroupName;
|
|
55
61
|
}
|
package/lib/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AACA,4FAAwF;AACxF,iGAAwF;AACxF,kGAAsG;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AACA,4FAAwF;AACxF,iGAAwF;AACxF,kGAAsG;AAetG,MAAa,QAAQ;IAGnB,YAA2B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C,MAAM,CAAC,KAAK,CAAC,MAAsB;QACxC,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAID,IAAI,cAAc;QAChB,IAAI,QAAQ,CAAC,mBAAmB,EAAE;YAChC,OAAO,QAAQ,CAAC,mBAAmB,CAAC;SACrC;QACD,QAAQ,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YACnC,KAAK,QAAQ;gBACX,QAAQ,CAAC,mBAAmB,GAAG,IAAI,0CAAmB,EAAE,CAAC;gBACzD,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC,KAAK,SAAS;gBACZ,QAAQ,CAAC,mBAAmB,GAAG,IAAI,gCAAoB,EAAE,CAAC;gBAC1D,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC,KAAK,gBAAgB;gBACnB,QAAQ,CAAC,mBAAmB,GAAG,IAAI,gDAA0B,EAAE,CAAC;gBAChE,OAAO,QAAQ,CAAC,mBAAmB,CAAC;YACtC;gBACE,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,IAAI,yCAAyC;QAC3C,OAAO,CAAC,CAAC;IACX,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;IACtC,CAAC;CACF;AApED,4BAoEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function truncate(str: string, n: number): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncate = void 0;
|
|
4
|
+
function truncate(str, n) {
|
|
5
|
+
return str.length > n ? str.substr(0, n - 1) + '…' : str;
|
|
6
|
+
}
|
|
7
|
+
exports.truncate = truncate;
|
|
8
|
+
//# sourceMappingURL=truncate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/util/truncate.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAW,EAAE,CAAS;IAC7C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAFD,4BAEC"}
|
package/package.json
CHANGED
package/src/cli/generate.ts
CHANGED
|
@@ -49,6 +49,15 @@ const argv = yargs.options({
|
|
|
49
49
|
default: 'Miscellaneous',
|
|
50
50
|
describe: 'Defines the @group name to be used when a file does not specify it.',
|
|
51
51
|
},
|
|
52
|
+
sanitizeHtml: {
|
|
53
|
+
type: 'boolean',
|
|
54
|
+
default: true,
|
|
55
|
+
describe:
|
|
56
|
+
'When on, any special character within your ApexDocs is converted into its HTML code representation. ' +
|
|
57
|
+
'This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" ' +
|
|
58
|
+
'because otherwise the content within < and > would be treated as HTML tags and not shown in the output. ' +
|
|
59
|
+
'Content in @example blocks are never sanitized.',
|
|
60
|
+
},
|
|
52
61
|
}).argv;
|
|
53
62
|
|
|
54
63
|
Settings.build({
|
|
@@ -59,6 +68,7 @@ Settings.build({
|
|
|
59
68
|
targetGenerator: argv.targetGenerator as GeneratorChoices,
|
|
60
69
|
indexOnly: argv.indexOnly,
|
|
61
70
|
defaultGroupName: argv.defaultGroupName,
|
|
71
|
+
sanitizeHtml: argv.sanitizeHtml,
|
|
62
72
|
});
|
|
63
73
|
|
|
64
74
|
Apexdocs.generate();
|
package/src/model/file.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import xss = require('xss');
|
|
2
|
+
import { Settings } from '../settings';
|
|
2
3
|
|
|
3
4
|
const xssFilter = new xss.FilterXSS({
|
|
4
|
-
whiteList: { br: [], p: [], ul: [], li: [] },
|
|
5
|
+
whiteList: { br: [], p: [], ul: [], li: [], code: [], pre: [] },
|
|
5
6
|
});
|
|
6
7
|
|
|
7
8
|
export abstract class File {
|
|
@@ -16,7 +17,8 @@ export abstract class File {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
addText(text: string, encodeHtml = true) {
|
|
19
|
-
const
|
|
20
|
+
const shouldEncode = encodeHtml && Settings.getInstance().sanitizeHtml;
|
|
21
|
+
const textToAdd = shouldEncode ? xssFilter.process(text) : text;
|
|
20
22
|
this._contents += textToAdd;
|
|
21
23
|
this.addBlankLine();
|
|
22
24
|
}
|
|
@@ -21,18 +21,19 @@ export class MarkdownFile extends File {
|
|
|
21
21
|
public addText(text: string, encodeHtml = true) {
|
|
22
22
|
text = MarkdownFile.replaceInlineLinks(text);
|
|
23
23
|
text = MarkdownFile.replaceInlineEmails(text);
|
|
24
|
+
|
|
24
25
|
super.addText(text, encodeHtml);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
startCodeBlock() {
|
|
28
|
-
this.
|
|
29
|
+
this.addText('```');
|
|
29
30
|
const sourceLanguage = 'apex';
|
|
30
31
|
this._contents += sourceLanguage;
|
|
31
32
|
this.addBlankLine();
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
endCodeBlock() {
|
|
35
|
-
this.
|
|
36
|
+
this.addText('```');
|
|
36
37
|
this.addBlankLine();
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -8,9 +8,11 @@ export function declareType(markdownFile: MarkdownFile, typeMirror: Type): void
|
|
|
8
8
|
markdownFile.addText(`\`${currentAnnotation.type.toUpperCase()}\``);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
if (typeMirror.docComment?.
|
|
11
|
+
if (typeMirror.docComment?.descriptionLines) {
|
|
12
12
|
markdownFile.addBlankLine();
|
|
13
|
-
|
|
13
|
+
for (const currentLine of typeMirror.docComment.descriptionLines) {
|
|
14
|
+
markdownFile.addText(currentLine);
|
|
15
|
+
}
|
|
14
16
|
markdownFile.addBlankLine();
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from '@cparra/apex-reflection';
|
|
2
2
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
3
3
|
import { MarkdownFile } from './markdown-file';
|
|
4
|
+
import { truncate } from '../util/truncate';
|
|
4
5
|
|
|
5
6
|
export class MarkdownHomeFile extends MarkdownFile {
|
|
6
7
|
constructor(public fileName: string, public types: Type[], headerContent?: string) {
|
|
@@ -26,7 +27,14 @@ export class MarkdownHomeFile extends MarkdownFile {
|
|
|
26
27
|
this.addBlankLine();
|
|
27
28
|
this.addTitle(ClassFileGeneratorHelper.getFileLink(typeMirror), 3);
|
|
28
29
|
this.addBlankLine();
|
|
29
|
-
|
|
30
|
+
|
|
31
|
+
if (typeMirror.docComment?.descriptionLines) {
|
|
32
|
+
const description = typeMirror.docComment.descriptionLines.reduce(
|
|
33
|
+
(previous, current) => previous + current + '\n',
|
|
34
|
+
'',
|
|
35
|
+
);
|
|
36
|
+
this.addText(truncate(description, 300));
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
private group(classes: Type[]): Map<string, Type[]> {
|
package/src/settings.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface SettingsConfig {
|
|
|
13
13
|
targetGenerator: GeneratorChoices;
|
|
14
14
|
indexOnly: boolean;
|
|
15
15
|
defaultGroupName: string;
|
|
16
|
+
sanitizeHtml: boolean;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export class Settings {
|
|
@@ -48,6 +49,7 @@ export class Settings {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
private static typeTranspilerCache?: ProcessorTypeTranspiler;
|
|
52
|
+
|
|
51
53
|
get typeTranspiler(): ProcessorTypeTranspiler {
|
|
52
54
|
if (Settings.typeTranspilerCache) {
|
|
53
55
|
return Settings.typeTranspilerCache;
|
|
@@ -71,6 +73,14 @@ export class Settings {
|
|
|
71
73
|
return this.config.indexOnly;
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
get sanitizeHtml(): boolean {
|
|
77
|
+
return this.config.sanitizeHtml;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get numberOfVisibleDescriptionLinesOnHomePage() {
|
|
81
|
+
return 5;
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
public getDefaultGroupName(): string {
|
|
75
85
|
return this.config.defaultGroupName;
|
|
76
86
|
}
|