@cparra/apexdocs 2.25.0-alpha.2 → 2.25.0-alpha.4

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.
Files changed (355) hide show
  1. package/README.md +37 -0
  2. package/dist/cli/generate.js +291 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +1 -0
  5. package/examples/plain-markdown/docs/Miscellaneous/ns.SampleException.md +18 -0
  6. package/examples/plain-markdown/docs/Miscellaneous/ns.SampleInterface.md +6 -2
  7. package/examples/plain-markdown/docs/Miscellaneous/ns.Url.md +320 -0
  8. package/examples/plain-markdown/docs/Sample-Enums/ns.SampleEnum.md +3 -1
  9. package/examples/plain-markdown/docs/SampleGroup/ns.SampleClass.md +1 -1
  10. package/examples/plain-markdown/docs/index.md +84 -0
  11. package/examples/plain-markdown/force-app/classes/SampleException.cls +16 -0
  12. package/examples/plain-markdown/force-app/classes/Url.cls +194 -0
  13. package/examples/plain-markdown/package.json +2 -1
  14. package/jest.config.js +1 -1
  15. package/package.json +11 -13
  16. package/src/__spec__/core/generating-class-docs.spec.ts +57 -37
  17. package/src/__spec__/core/generating-enum-docs.spec.ts +25 -22
  18. package/src/__spec__/core/generating-interface-docs.spec.ts +33 -30
  19. package/src/__spec__/core/generating-reference-guide.spec.ts +8 -7
  20. package/src/__spec__/core/test-helpers.ts +9 -0
  21. package/src/application/Apexdocs.ts +34 -5
  22. package/src/application/{flows → generators}/generate-markdown-files.ts +19 -13
  23. package/src/cli/args.ts +138 -0
  24. package/src/cli/generate.ts +12 -138
  25. package/src/core/adapters/__tests__/documentables.spec.ts +109 -0
  26. package/src/{adapters → core/adapters}/__tests__/interface-adapter.spec.ts +13 -11
  27. package/src/{adapters → core/adapters}/__tests__/references.spec.ts +23 -2
  28. package/src/{adapters → core/adapters}/apex-types.ts +18 -15
  29. package/src/{adapters → core/adapters}/documentables.ts +54 -12
  30. package/src/{adapters → core/adapters}/fields-and-properties.ts +17 -10
  31. package/src/{adapters/references.ts → core/adapters/inline.ts} +43 -13
  32. package/src/{adapters → core/adapters}/methods-and-constructors.ts +21 -9
  33. package/src/core/adapters/type-utils.ts +13 -0
  34. package/src/core/{renderable → adapters}/types.d.ts +42 -4
  35. package/src/core/generate-docs.ts +55 -19
  36. package/src/core/template.ts +15 -9
  37. package/src/core/templates/reference-guide.ts +1 -1
  38. package/src/model/__tests__/manifest.spec.ts +1 -1
  39. package/src/model/markdown-generation-util/field-declaration-util.ts +1 -1
  40. package/src/model/markdown-generation-util/method-declaration-util.ts +1 -1
  41. package/src/model/markdown-type-file.ts +5 -1
  42. package/src/service/__tests__/apex-file-reader.spec.ts +1 -0
  43. package/src/service/apex-file-reader.ts +2 -6
  44. package/src/service/manifest-factory.ts +2 -2
  45. package/src/service/parser.ts +1 -1
  46. package/src/settings.ts +6 -10
  47. package/src/test-helpers/SettingsBuilder.ts +1 -2
  48. package/src/transpiler/factory.ts +2 -4
  49. package/src/transpiler/markdown/class-file-generatorHelper.ts +1 -18
  50. package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +2 -2
  51. package/src/transpiler/markdown/plain-markdown/documentable-partial-template.ts +6 -4
  52. package/src/transpiler/markdown/plain-markdown/fieldsPartialTemplate.ts +1 -1
  53. package/src/transpiler/markdown/plain-markdown/methods-partial-template.ts +2 -2
  54. package/src/util/fp.ts +3 -0
  55. package/tsconfig.json +1 -1
  56. package/docs/.nojekyll +0 -0
  57. package/docs/__old/README.md +0 -1
  58. package/docs/__old/index.html +0 -22
  59. package/docs/__old/restapi.json +0 -589
  60. package/docs/__old/types/Classes/nspc.AnotherInterface.md +0 -22
  61. package/docs/__old/types/Classes/nspc.ChildClass.md +0 -97
  62. package/docs/__old/types/Main/nspc.GroupedClass.md +0 -10
  63. package/docs/__old/types/Main/nspc.SampleClass.md +0 -189
  64. package/docs/__old/types/Misc-Group/nspc.EscapedAnnotations.md +0 -4
  65. package/docs/__old/types/Misc-Group/nspc.GrandparentClass.md +0 -13
  66. package/docs/__old/types/Misc-Group/nspc.InterfaceWithInheritance.md +0 -29
  67. package/docs/__old/types/Misc-Group/nspc.MemberGrouping.md +0 -13
  68. package/docs/__old/types/Misc-Group/nspc.ParentClass.md +0 -37
  69. package/docs/__old/types/Misc-Group/nspc.Reference1.md +0 -18
  70. package/docs/__old/types/Misc-Group/nspc.Reference2.md +0 -12
  71. package/docs/__old/types/Misc-Group/nspc.Reference3.md +0 -7
  72. package/docs/__old/types/Misc-Group/nspc.Reference4.md +0 -7
  73. package/docs/__old/types/Misc-Group/nspc.Reference5.md +0 -7
  74. package/docs/__old/types/Misc-Group/nspc.Reference6.md +0 -9
  75. package/docs/__old/types/Misc-Group/nspc.Reference7.md +0 -7
  76. package/docs/__old/types/Misc-Group/nspc.SampleClassWithoutModifier.md +0 -11
  77. package/docs/__old/types/Misc-Group/nspc.SampleRestResource.md +0 -104
  78. package/docs/__old/types/Misc-Group/nspc.SampleRestResourceWithInnerClass.md +0 -33
  79. package/docs/__old/types/Misc-Group/nspc.SampleRestResourceWithoutApexDocs.md +0 -14
  80. package/docs/__old/types/README.md +0 -97
  81. package/docs/__old/types/Sample-Interfaces/nspc.SampleInterface.md +0 -23
  82. package/examples/includes/header.md +0 -3
  83. package/lib/__spec__/core/expect-extensions.d.ts +0 -3
  84. package/lib/__spec__/core/expect-extensions.js +0 -54
  85. package/lib/__spec__/core/expect-extensions.js.map +0 -1
  86. package/lib/__spec__/core/generating-class-docs.spec.d.ts +0 -1
  87. package/lib/__spec__/core/generating-class-docs.spec.js +0 -427
  88. package/lib/__spec__/core/generating-class-docs.spec.js.map +0 -1
  89. package/lib/__spec__/core/generating-enum-docs.spec.d.ts +0 -1
  90. package/lib/__spec__/core/generating-enum-docs.spec.js +0 -303
  91. package/lib/__spec__/core/generating-enum-docs.spec.js.map +0 -1
  92. package/lib/__spec__/core/generating-interface-docs.spec.d.ts +0 -1
  93. package/lib/__spec__/core/generating-interface-docs.spec.js +0 -361
  94. package/lib/__spec__/core/generating-interface-docs.spec.js.map +0 -1
  95. package/lib/__spec__/core/generating-reference-guide.spec.d.ts +0 -1
  96. package/lib/__spec__/core/generating-reference-guide.spec.js +0 -161
  97. package/lib/__spec__/core/generating-reference-guide.spec.js.map +0 -1
  98. package/lib/adapters/apex-types.d.ts +0 -5
  99. package/lib/adapters/apex-types.js +0 -109
  100. package/lib/adapters/apex-types.js.map +0 -1
  101. package/lib/adapters/documentables.d.ts +0 -7
  102. package/lib/adapters/documentables.js +0 -56
  103. package/lib/adapters/documentables.js.map +0 -1
  104. package/lib/adapters/fields-and-properties.d.ts +0 -4
  105. package/lib/adapters/fields-and-properties.js +0 -31
  106. package/lib/adapters/fields-and-properties.js.map +0 -1
  107. package/lib/adapters/methods-and-constructors.d.ts +0 -5
  108. package/lib/adapters/methods-and-constructors.js +0 -91
  109. package/lib/adapters/methods-and-constructors.js.map +0 -1
  110. package/lib/adapters/references.d.ts +0 -5
  111. package/lib/adapters/references.js +0 -82
  112. package/lib/adapters/references.js.map +0 -1
  113. package/lib/adapters/type-utils.d.ts +0 -2
  114. package/lib/adapters/type-utils.js +0 -7
  115. package/lib/adapters/type-utils.js.map +0 -1
  116. package/lib/application/Apexdocs.d.ts +0 -13
  117. package/lib/application/Apexdocs.js +0 -86
  118. package/lib/application/Apexdocs.js.map +0 -1
  119. package/lib/application/flows/generate-markdown-files.d.ts +0 -3
  120. package/lib/application/flows/generate-markdown-files.js +0 -57
  121. package/lib/application/flows/generate-markdown-files.js.map +0 -1
  122. package/lib/cli/generate.d.ts +0 -2
  123. package/lib/cli/generate.js +0 -157
  124. package/lib/cli/generate.js.map +0 -1
  125. package/lib/core/__test__/inheritance-chain.test.d.ts +0 -1
  126. package/lib/core/__test__/inheritance-chain.test.js +0 -42
  127. package/lib/core/__test__/inheritance-chain.test.js.map +0 -1
  128. package/lib/core/generate-docs.d.ts +0 -24
  129. package/lib/core/generate-docs.js +0 -267
  130. package/lib/core/generate-docs.js.map +0 -1
  131. package/lib/core/inheritance-chain.d.ts +0 -2
  132. package/lib/core/inheritance-chain.js +0 -35
  133. package/lib/core/inheritance-chain.js.map +0 -1
  134. package/lib/core/template.d.ts +0 -10
  135. package/lib/core/template.js +0 -92
  136. package/lib/core/template.js.map +0 -1
  137. package/lib/core/templates/reference-guide.d.ts +0 -1
  138. package/lib/core/templates/reference-guide.js +0 -18
  139. package/lib/core/templates/reference-guide.js.map +0 -1
  140. package/lib/index.d.ts +0 -2
  141. package/lib/index.js +0 -29
  142. package/lib/index.js.map +0 -1
  143. package/lib/model/apex-bundle.d.ts +0 -6
  144. package/lib/model/apex-bundle.js +0 -11
  145. package/lib/model/apex-bundle.js.map +0 -1
  146. package/lib/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +0 -7
  147. package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js +0 -14
  148. package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js.map +0 -1
  149. package/lib/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +0 -7
  150. package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js +0 -12
  151. package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js.map +0 -1
  152. package/lib/model/inheritance.d.ts +0 -11
  153. package/lib/model/inheritance.js +0 -3
  154. package/lib/model/inheritance.js.map +0 -1
  155. package/lib/model/manifest.d.ts +0 -22
  156. package/lib/model/manifest.js +0 -53
  157. package/lib/model/manifest.js.map +0 -1
  158. package/lib/model/markdown-file.d.ts +0 -16
  159. package/lib/model/markdown-file.js +0 -111
  160. package/lib/model/markdown-file.js.map +0 -1
  161. package/lib/model/markdown-generation-util/doc-comment-annotation-util.d.ts +0 -8
  162. package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +0 -46
  163. package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +0 -1
  164. package/lib/model/markdown-generation-util/field-declaration-util.d.ts +0 -3
  165. package/lib/model/markdown-generation-util/field-declaration-util.js +0 -54
  166. package/lib/model/markdown-generation-util/field-declaration-util.js.map +0 -1
  167. package/lib/model/markdown-generation-util/index.d.ts +0 -3
  168. package/lib/model/markdown-generation-util/index.js +0 -20
  169. package/lib/model/markdown-generation-util/index.js.map +0 -1
  170. package/lib/model/markdown-generation-util/method-declaration-util.d.ts +0 -4
  171. package/lib/model/markdown-generation-util/method-declaration-util.js +0 -114
  172. package/lib/model/markdown-generation-util/method-declaration-util.js.map +0 -1
  173. package/lib/model/markdown-generation-util/type-declaration-util.d.ts +0 -3
  174. package/lib/model/markdown-generation-util/type-declaration-util.js +0 -81
  175. package/lib/model/markdown-generation-util/type-declaration-util.js.map +0 -1
  176. package/lib/model/markdown-home-file.d.ts +0 -11
  177. package/lib/model/markdown-home-file.js +0 -57
  178. package/lib/model/markdown-home-file.js.map +0 -1
  179. package/lib/model/markdown-type-file.d.ts +0 -26
  180. package/lib/model/markdown-type-file.js +0 -137
  181. package/lib/model/markdown-type-file.js.map +0 -1
  182. package/lib/model/openapi/apex-doc-types.d.ts +0 -19
  183. package/lib/model/openapi/apex-doc-types.js +0 -5
  184. package/lib/model/openapi/apex-doc-types.js.map +0 -1
  185. package/lib/model/openapi/open-api-types.d.ts +0 -93
  186. package/lib/model/openapi/open-api-types.js +0 -3
  187. package/lib/model/openapi/open-api-types.js.map +0 -1
  188. package/lib/model/openapi/open-api.d.ts +0 -16
  189. package/lib/model/openapi/open-api.js +0 -34
  190. package/lib/model/openapi/open-api.js.map +0 -1
  191. package/lib/model/openapi/openapi-type-file.d.ts +0 -7
  192. package/lib/model/openapi/openapi-type-file.js +0 -17
  193. package/lib/model/openapi/openapi-type-file.js.map +0 -1
  194. package/lib/model/outputFile.d.ts +0 -10
  195. package/lib/model/outputFile.js +0 -22
  196. package/lib/model/outputFile.js.map +0 -1
  197. package/lib/model/types-repository.d.ts +0 -16
  198. package/lib/model/types-repository.js +0 -54
  199. package/lib/model/types-repository.js.map +0 -1
  200. package/lib/service/apex-file-reader.d.ts +0 -14
  201. package/lib/service/apex-file-reader.js +0 -49
  202. package/lib/service/apex-file-reader.js.map +0 -1
  203. package/lib/service/file-system.d.ts +0 -14
  204. package/lib/service/file-system.js +0 -48
  205. package/lib/service/file-system.js.map +0 -1
  206. package/lib/service/file-writer.d.ts +0 -6
  207. package/lib/service/file-writer.js +0 -57
  208. package/lib/service/file-writer.js.map +0 -1
  209. package/lib/service/manifest-factory.d.ts +0 -10
  210. package/lib/service/manifest-factory.js +0 -16
  211. package/lib/service/manifest-factory.js.map +0 -1
  212. package/lib/service/metadata-processor.d.ts +0 -3
  213. package/lib/service/metadata-processor.js +0 -17
  214. package/lib/service/metadata-processor.js.map +0 -1
  215. package/lib/service/parser.d.ts +0 -21
  216. package/lib/service/parser.js +0 -138
  217. package/lib/service/parser.js.map +0 -1
  218. package/lib/service/state.d.ts +0 -9
  219. package/lib/service/state.js +0 -20
  220. package/lib/service/state.js.map +0 -1
  221. package/lib/service/walkers/class-walker.d.ts +0 -4
  222. package/lib/service/walkers/class-walker.js +0 -33
  223. package/lib/service/walkers/class-walker.js.map +0 -1
  224. package/lib/service/walkers/enum-walker.d.ts +0 -4
  225. package/lib/service/walkers/enum-walker.js +0 -11
  226. package/lib/service/walkers/enum-walker.js.map +0 -1
  227. package/lib/service/walkers/interface-walker.d.ts +0 -4
  228. package/lib/service/walkers/interface-walker.js +0 -15
  229. package/lib/service/walkers/interface-walker.js.map +0 -1
  230. package/lib/service/walkers/walker-factory.d.ts +0 -5
  231. package/lib/service/walkers/walker-factory.js +0 -21
  232. package/lib/service/walkers/walker-factory.js.map +0 -1
  233. package/lib/service/walkers/walker.d.ts +0 -19
  234. package/lib/service/walkers/walker.js +0 -17
  235. package/lib/service/walkers/walker.js.map +0 -1
  236. package/lib/settings.d.ts +0 -64
  237. package/lib/settings.js +0 -89
  238. package/lib/settings.js.map +0 -1
  239. package/lib/test-helpers/AnnotationBuilder.d.ts +0 -12
  240. package/lib/test-helpers/AnnotationBuilder.js +0 -31
  241. package/lib/test-helpers/AnnotationBuilder.js.map +0 -1
  242. package/lib/test-helpers/ClassMirrorBuilder.d.ts +0 -22
  243. package/lib/test-helpers/ClassMirrorBuilder.js +0 -64
  244. package/lib/test-helpers/ClassMirrorBuilder.js.map +0 -1
  245. package/lib/test-helpers/DocCommentAnnotationBuilder.d.ts +0 -8
  246. package/lib/test-helpers/DocCommentAnnotationBuilder.js +0 -26
  247. package/lib/test-helpers/DocCommentAnnotationBuilder.js.map +0 -1
  248. package/lib/test-helpers/DocCommentBuilder.d.ts +0 -12
  249. package/lib/test-helpers/DocCommentBuilder.js +0 -38
  250. package/lib/test-helpers/DocCommentBuilder.js.map +0 -1
  251. package/lib/test-helpers/FieldMirrorBuilder.d.ts +0 -18
  252. package/lib/test-helpers/FieldMirrorBuilder.js +0 -54
  253. package/lib/test-helpers/FieldMirrorBuilder.js.map +0 -1
  254. package/lib/test-helpers/InterfaceMirrorBuilder.d.ts +0 -16
  255. package/lib/test-helpers/InterfaceMirrorBuilder.js +0 -43
  256. package/lib/test-helpers/InterfaceMirrorBuilder.js.map +0 -1
  257. package/lib/test-helpers/MethodMirrorBuilder.d.ts +0 -29
  258. package/lib/test-helpers/MethodMirrorBuilder.js +0 -72
  259. package/lib/test-helpers/MethodMirrorBuilder.js.map +0 -1
  260. package/lib/test-helpers/SettingsBuilder.d.ts +0 -8
  261. package/lib/test-helpers/SettingsBuilder.js +0 -27
  262. package/lib/test-helpers/SettingsBuilder.js.map +0 -1
  263. package/lib/transpiler/factory.d.ts +0 -6
  264. package/lib/transpiler/factory.js +0 -35
  265. package/lib/transpiler/factory.js.map +0 -1
  266. package/lib/transpiler/file-container.d.ts +0 -6
  267. package/lib/transpiler/file-container.js +0 -16
  268. package/lib/transpiler/file-container.js.map +0 -1
  269. package/lib/transpiler/generator-choices.d.ts +0 -1
  270. package/lib/transpiler/generator-choices.js +0 -3
  271. package/lib/transpiler/generator-choices.js.map +0 -1
  272. package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +0 -11
  273. package/lib/transpiler/markdown/class-file-generatorHelper.js +0 -75
  274. package/lib/transpiler/markdown/class-file-generatorHelper.js.map +0 -1
  275. package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +0 -6
  276. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +0 -13
  277. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +0 -1
  278. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +0 -11
  279. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +0 -51
  280. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +0 -1
  281. package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +0 -11
  282. package/lib/transpiler/markdown/markdown-transpiler-base.js +0 -27
  283. package/lib/transpiler/markdown/markdown-transpiler-base.js.map +0 -1
  284. package/lib/transpiler/markdown/plain-markdown/class-template.d.ts +0 -1
  285. package/lib/transpiler/markdown/plain-markdown/class-template.js +0 -77
  286. package/lib/transpiler/markdown/plain-markdown/class-template.js.map +0 -1
  287. package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.d.ts +0 -1
  288. package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js +0 -36
  289. package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +0 -1
  290. package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.d.ts +0 -1
  291. package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js +0 -28
  292. package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +0 -1
  293. package/lib/transpiler/markdown/plain-markdown/enum-template.d.ts +0 -1
  294. package/lib/transpiler/markdown/plain-markdown/enum-template.js +0 -16
  295. package/lib/transpiler/markdown/plain-markdown/enum-template.js.map +0 -1
  296. package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.d.ts +0 -1
  297. package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +0 -27
  298. package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +0 -1
  299. package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.d.ts +0 -1
  300. package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js +0 -10
  301. package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js.map +0 -1
  302. package/lib/transpiler/markdown/plain-markdown/interface-template.d.ts +0 -1
  303. package/lib/transpiler/markdown/plain-markdown/interface-template.js +0 -20
  304. package/lib/transpiler/markdown/plain-markdown/interface-template.js.map +0 -1
  305. package/lib/transpiler/markdown/plain-markdown/methods-partial-template.d.ts +0 -1
  306. package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js +0 -47
  307. package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js.map +0 -1
  308. package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +0 -9
  309. package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +0 -42
  310. package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +0 -1
  311. package/lib/transpiler/markdown/plain-markdown/type-doc-partial.d.ts +0 -1
  312. package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js +0 -31
  313. package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js.map +0 -1
  314. package/lib/transpiler/openapi/open-api-docs-processor.d.ts +0 -13
  315. package/lib/transpiler/openapi/open-api-docs-processor.js +0 -78
  316. package/lib/transpiler/openapi/open-api-docs-processor.js.map +0 -1
  317. package/lib/transpiler/openapi/parsers/Builder.d.ts +0 -16
  318. package/lib/transpiler/openapi/parsers/Builder.js +0 -30
  319. package/lib/transpiler/openapi/parsers/Builder.js.map +0 -1
  320. package/lib/transpiler/openapi/parsers/MethodParser.d.ts +0 -20
  321. package/lib/transpiler/openapi/parsers/MethodParser.js +0 -190
  322. package/lib/transpiler/openapi/parsers/MethodParser.js.map +0 -1
  323. package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +0 -7
  324. package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js +0 -11
  325. package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +0 -1
  326. package/lib/transpiler/openapi/parsers/ReferenceBuilder.d.ts +0 -39
  327. package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +0 -250
  328. package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +0 -1
  329. package/lib/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +0 -10
  330. package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js +0 -20
  331. package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js.map +0 -1
  332. package/lib/transpiler/openapi/parsers/ResponsesBuilder.d.ts +0 -7
  333. package/lib/transpiler/openapi/parsers/ResponsesBuilder.js +0 -22
  334. package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +0 -1
  335. package/lib/transpiler/processor-type-transpiler.d.ts +0 -10
  336. package/lib/transpiler/processor-type-transpiler.js +0 -9
  337. package/lib/transpiler/processor-type-transpiler.js.map +0 -1
  338. package/lib/transpiler/transpiler.d.ts +0 -5
  339. package/lib/transpiler/transpiler.js +0 -30
  340. package/lib/transpiler/transpiler.js.map +0 -1
  341. package/lib/util/error-logger.d.ts +0 -8
  342. package/lib/util/error-logger.js +0 -90
  343. package/lib/util/error-logger.js.map +0 -1
  344. package/lib/util/logger.d.ts +0 -21
  345. package/lib/util/logger.js +0 -61
  346. package/lib/util/logger.js.map +0 -1
  347. package/lib/util/string-utils.d.ts +0 -2
  348. package/lib/util/string-utils.js +0 -15
  349. package/lib/util/string-utils.js.map +0 -1
  350. package/src/adapters/type-utils.ts +0 -5
  351. package/src/adapters/types.d.ts +0 -8
  352. package/src/model/inheritance.ts +0 -8
  353. package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +0 -42
  354. /package/src/{model → core}/apex-bundle.ts +0 -0
  355. /package/src/{model → core}/manifest.ts +0 -0
@@ -1,140 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import * as yargs from 'yargs';
3
-
4
- import { Settings } from '../settings';
5
2
  import { Apexdocs } from '../application/Apexdocs';
6
- import { GeneratorChoices } from '../transpiler/generator-choices';
7
- import { cosmiconfig } from 'cosmiconfig';
8
-
9
- const result = cosmiconfig('apexdocs').search();
10
- result.then((config) => {
11
- yargs.config(config?.config);
12
- let argv = yargs
13
- .options({
14
- sourceDir: {
15
- type: 'string',
16
- alias: 's',
17
- demandOption: true,
18
- describe: 'The directory location which contains your apex .cls classes.',
19
- },
20
- targetDir: {
21
- type: 'string',
22
- alias: 't',
23
- default: './docs/',
24
- describe: 'The directory location where documentation will be generated to.',
25
- },
26
- recursive: {
27
- type: 'boolean',
28
- alias: 'r',
29
- default: true,
30
- describe: 'Whether .cls classes will be searched for recursively in the directory provided.',
31
- },
32
- scope: {
33
- type: 'string',
34
- array: true,
35
- alias: 'p',
36
- default: ['global'],
37
- describe:
38
- 'A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. ' +
39
- 'Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled. ' +
40
- 'Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource.',
41
- },
42
- targetGenerator: {
43
- type: 'string',
44
- alias: 'g',
45
- default: 'jekyll',
46
- choices: ['jekyll', 'docsify', 'plain-markdown', 'openapi'],
47
- describe:
48
- 'Define the static file generator for which the documents will be created. ' +
49
- 'Currently supports jekyll, docsify, plain markdown, and OpenAPI v3.1.0.',
50
- },
51
- indexOnly: {
52
- type: 'boolean',
53
- default: false,
54
- describe: 'Defines whether only the index file should be generated.',
55
- },
56
- defaultGroupName: {
57
- type: 'string',
58
- default: 'Miscellaneous',
59
- describe: 'Defines the @group name to be used when a file does not specify it.',
60
- },
61
- sanitizeHtml: {
62
- type: 'boolean',
63
- default: true,
64
- describe:
65
- 'When on, any special character within your ApexDocs is converted into its HTML code representation. ' +
66
- 'This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" ' +
67
- 'because otherwise the content within < and > would be treated as HTML tags and not shown in the output. ' +
68
- 'Content in @example blocks are never sanitized.',
69
- },
70
- openApiTitle: {
71
- type: 'string',
72
- default: 'Apex REST Api',
73
- describe: 'If using "openapi" as the target generator, this allows you to specify the OpenApi title value.',
74
- },
75
- title: {
76
- type: 'string',
77
- describe: "If this allows you to specify the title of the generated documentation's home file.",
78
- default: 'Classes',
79
- },
80
- namespace: {
81
- type: 'string',
82
- describe:
83
- 'The package namespace, if any. If this value is provided the namespace will be added as a prefix to all of the parsed files. ' +
84
- "If generating an OpenApi definition, it will be added to the file's Server Url.",
85
- },
86
- openApiFileName: {
87
- type: 'string',
88
- describe: 'If using "openapi" as the target generator, this allows you to specify the name of the output file.',
89
- default: 'openapi',
90
- },
91
- sortMembersAlphabetically: {
92
- type: 'boolean',
93
- describe: 'Whether to sort members alphabetically.',
94
- default: false,
95
- },
96
- includeMetadata: {
97
- type: 'boolean',
98
- describe: "Whether to include the file's meta.xml information: Whether it is active and and the API version",
99
- default: false,
100
- },
101
- documentationRootDir: {
102
- type: 'string',
103
- describe:
104
- 'Allows you to specify the root documentation directory where the files are being generated. This can be helpful when embedding the generated docs into an existing site so that the links are generated correctly.',
105
- },
106
- })
107
- .parseSync();
108
-
109
- if (config) {
110
- argv = { ...config.config, ...argv };
111
- }
112
-
113
- Settings.build({
114
- sourceDirectory: argv.sourceDir,
115
- recursive: argv.recursive,
116
- scope: argv.scope,
117
- outputDir: argv.targetDir,
118
- targetGenerator: argv.targetGenerator as GeneratorChoices,
119
- indexOnly: argv.indexOnly,
120
- defaultGroupName: argv.defaultGroupName,
121
- sanitizeHtml: argv.sanitizeHtml,
122
- openApiTitle: argv.openApiTitle,
123
- title: argv.title,
124
- namespace: argv.namespace,
125
- openApiFileName: argv.openApiFileName,
126
- sortMembersAlphabetically: argv.sortMembersAlphabetically,
127
- includeMetadata: argv.includeMetadata,
128
- rootDir: argv.documentationRootDir,
129
- onAfterProcess: config?.config?.onAfterProcess,
130
- onBeforeFileWrite: config?.config?.onBeforeFileWrite,
131
- frontMatterHeader: config?.config?.frontMatterHeader,
132
- });
133
-
134
- try {
135
- Apexdocs.generate();
136
- } catch (error) {
137
- console.error(error);
138
- process.exit(1);
139
- }
140
- });
3
+ import { extractArgs } from './args';
4
+
5
+ function main() {
6
+ extractArgs()
7
+ .then((config) => Apexdocs.generate(config))
8
+ .catch((error) => {
9
+ console.error(error);
10
+ process.exit(1);
11
+ });
12
+ }
13
+
14
+ main();
@@ -0,0 +1,109 @@
1
+ import { adaptDescribable } from '../documentables';
2
+
3
+ function linkGenerator(typeName: string) {
4
+ return typeName;
5
+ }
6
+
7
+ describe('describable', () => {
8
+ it('returns undefined if describable is undefined', () => {
9
+ const result = adaptDescribable(undefined, linkGenerator);
10
+
11
+ expect(result).toEqual({
12
+ description: undefined,
13
+ });
14
+ });
15
+
16
+ it('returns an empty array if describable is an empty array', () => {
17
+ const result = adaptDescribable([], linkGenerator);
18
+
19
+ expect(result).toEqual({
20
+ description: [],
21
+ });
22
+ });
23
+
24
+ it('returns a string if describable contains a string', () => {
25
+ const describable = ['This is a test'];
26
+
27
+ const result = adaptDescribable(describable, linkGenerator);
28
+
29
+ expect(result).toEqual({
30
+ description: ['This is a test'],
31
+ });
32
+ });
33
+
34
+ it('separates strings with an empty line', () => {
35
+ const describable = ['This is a test', 'This is another test'];
36
+
37
+ const result = adaptDescribable(describable, linkGenerator);
38
+
39
+ expect(result).toEqual({
40
+ description: ['This is a test', { __type: 'empty-line' }, 'This is another test'],
41
+ });
42
+ });
43
+
44
+ it('returns a code block if describable contains code', () => {
45
+ const describable = ['```typescript', 'const a = 1;', '```'];
46
+
47
+ const result = adaptDescribable(describable, linkGenerator);
48
+
49
+ expect(result).toEqual({
50
+ description: [
51
+ {
52
+ __type: 'code-block',
53
+ language: 'typescript',
54
+ content: ['const a = 1;'],
55
+ },
56
+ ],
57
+ });
58
+ });
59
+
60
+ it('sets the code blocks language to apex if one is not provided', () => {
61
+ const describable = ['```', 'const a = 1;', '```'];
62
+
63
+ const result = adaptDescribable(describable, linkGenerator);
64
+
65
+ expect(result).toEqual({
66
+ description: [
67
+ {
68
+ __type: 'code-block',
69
+ language: 'apex',
70
+ content: ['const a = 1;'],
71
+ },
72
+ ],
73
+ });
74
+ });
75
+
76
+ it('returns a code block followed by an empty line and then whatever content is in the describable', () => {
77
+ const describable = ['```typescript', 'const a = 1;', '```', 'This is a test'];
78
+
79
+ const result = adaptDescribable(describable, linkGenerator);
80
+
81
+ expect(result).toEqual({
82
+ description: [
83
+ {
84
+ __type: 'code-block',
85
+ language: 'typescript',
86
+ content: ['const a = 1;'],
87
+ },
88
+ { __type: 'empty-line' },
89
+ 'This is a test',
90
+ ],
91
+ });
92
+ });
93
+
94
+ it('returns a code block even when there is no closing tag', () => {
95
+ const describable = ['```typescript', 'const a = 1;'];
96
+
97
+ const result = adaptDescribable(describable, linkGenerator);
98
+
99
+ expect(result).toEqual({
100
+ description: [
101
+ {
102
+ __type: 'code-block',
103
+ language: 'typescript',
104
+ content: ['const a = 1;'],
105
+ },
106
+ ],
107
+ });
108
+ });
109
+ });
@@ -1,7 +1,7 @@
1
- import { InterfaceMirrorBuilder } from '../../test-helpers/InterfaceMirrorBuilder';
2
- import { AnnotationBuilder } from '../../test-helpers/AnnotationBuilder';
3
- import { MethodMirrorBuilder, ParameterBuilder } from '../../test-helpers/MethodMirrorBuilder';
4
- import { interfaceTypeToInterfaceSource } from '../apex-types';
1
+ import { typeToRenderable } from '../apex-types';
2
+ import { InterfaceMirrorBuilder } from '../../../test-helpers/InterfaceMirrorBuilder';
3
+ import { AnnotationBuilder } from '../../../test-helpers/AnnotationBuilder';
4
+ import { MethodMirrorBuilder, ParameterBuilder } from '../../../test-helpers/MethodMirrorBuilder';
5
5
 
6
6
  function linkGenerator(type: string): string {
7
7
  return type;
@@ -10,14 +10,14 @@ function linkGenerator(type: string): string {
10
10
  describe('Conversion from InterfaceMirror to InterfaceSource understandable by the templating engine', () => {
11
11
  it('converts the name', () => {
12
12
  const interfaceMirror = new InterfaceMirrorBuilder().withName('SampleInterface').build();
13
- const interfaceSource = interfaceTypeToInterfaceSource(interfaceMirror, linkGenerator);
13
+ const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
14
14
 
15
15
  expect(interfaceSource.name).toBe('SampleInterface');
16
16
  });
17
17
 
18
18
  it('converts the access modifier', () => {
19
19
  const interfaceMirror = new InterfaceMirrorBuilder().build();
20
- const interfaceSource = interfaceTypeToInterfaceSource(interfaceMirror, linkGenerator);
20
+ const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
21
21
 
22
22
  expect(interfaceSource.meta.accessModifier).toBe('public');
23
23
  });
@@ -26,7 +26,7 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
26
26
  const interfaceMirror = new InterfaceMirrorBuilder()
27
27
  .addAnnotation(new AnnotationBuilder().withName('MyAnnotation').build())
28
28
  .build();
29
- const interfaceSource = interfaceTypeToInterfaceSource(interfaceMirror, linkGenerator);
29
+ const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
30
30
 
31
31
  expect(interfaceSource.doc.annotations).toEqual(['MYANNOTATION']);
32
32
  });
@@ -44,10 +44,10 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
44
44
  )
45
45
  .build();
46
46
 
47
- const interfaceSource = interfaceTypeToInterfaceSource(interfaceMirror, linkGenerator);
47
+ const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
48
48
 
49
49
  expect(interfaceSource.methods.value).toHaveLength(1);
50
- expect(interfaceSource.methods.value[0].signature.value[0]).toBe('public String sampleMethod()');
50
+ expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe('public String sampleMethod()');
51
51
  });
52
52
 
53
53
  it('converts method declarations. Method with parameters', () => {
@@ -72,9 +72,11 @@ describe('Conversion from InterfaceMirror to InterfaceSource understandable by t
72
72
  )
73
73
  .build();
74
74
 
75
- const interfaceSource = interfaceTypeToInterfaceSource(interfaceMirror, linkGenerator);
75
+ const interfaceSource = typeToRenderable(interfaceMirror, linkGenerator);
76
76
 
77
77
  expect(interfaceSource.methods.value).toHaveLength(1);
78
- expect(interfaceSource.methods.value[0].signature.value[0]).toBe('public String sampleMethod(String param1)');
78
+ expect(interfaceSource.methods.value[0].signature.value.content[0]).toBe(
79
+ 'public String sampleMethod(String param1)',
80
+ );
79
81
  });
80
82
  });
@@ -1,8 +1,9 @@
1
- import { replaceInlineReferences } from '../references';
2
- import { Link } from '../../core/renderable/types';
1
+ import { replaceInlineReferences } from '../inline';
2
+ import { Link } from '../types';
3
3
 
4
4
  function getFileLink(typeName: string): Link {
5
5
  return {
6
+ __type: 'link' as const,
6
7
  title: typeName,
7
8
  url: `/api/${typeName}.html`,
8
9
  };
@@ -10,6 +11,7 @@ function getFileLink(typeName: string): Link {
10
11
 
11
12
  function getEmailLink(typeName: string) {
12
13
  return {
14
+ __type: 'link' as const,
13
15
  title: typeName,
14
16
  url: `mailto:${typeName}`,
15
17
  };
@@ -25,6 +27,17 @@ describe('reference utilities', () => {
25
27
  expect(result).toEqual(expected);
26
28
  });
27
29
 
30
+ describe('replace inline code', () => {
31
+ it('replaces inline code with InlineCode', () => {
32
+ const text = 'This is a test `ClassName`.';
33
+ const result = replaceInlineReferences(text, getFileLink, getEmailLink);
34
+
35
+ const expected = ['This is a test ', { __type: 'inline-code', content: 'ClassName' }, '.'];
36
+
37
+ expect(result).toEqual(expected);
38
+ });
39
+ });
40
+
28
41
  describe('replace inline links', () => {
29
42
  it('replaces links in the format of <<ClassName>>', () => {
30
43
  const text = 'This is a test <<ClassName>>.';
@@ -33,6 +46,7 @@ describe('reference utilities', () => {
33
46
  const expected = [
34
47
  'This is a test ',
35
48
  {
49
+ __type: 'link',
36
50
  title: 'ClassName',
37
51
  url: '/api/ClassName.html',
38
52
  },
@@ -44,6 +58,7 @@ describe('reference utilities', () => {
44
58
  it('replaces links in the format of {@link ClassName}', () => {
45
59
  function getFileLinkByTypeName(typeName: string): Link {
46
60
  return {
61
+ __type: 'link' as const,
47
62
  title: typeName,
48
63
  url: `/api/${typeName}.html`,
49
64
  };
@@ -55,6 +70,7 @@ describe('reference utilities', () => {
55
70
  const expected = [
56
71
  'This is a test ',
57
72
  {
73
+ __type: 'link',
58
74
  title: 'ClassName',
59
75
  url: '/api/ClassName.html',
60
76
  },
@@ -68,6 +84,7 @@ describe('reference utilities', () => {
68
84
  it('replaces emails in the format of {@email email-address}', () => {
69
85
  function getLinkByTypeName(typeName: string) {
70
86
  return {
87
+ __type: 'link' as const,
71
88
  title: typeName,
72
89
  url: `mailto:${typeName}`,
73
90
  };
@@ -79,6 +96,7 @@ describe('reference utilities', () => {
79
96
  const expected = [
80
97
  'This is an email ',
81
98
  {
99
+ __type: 'link',
82
100
  title: 'example@example.com',
83
101
  url: 'mailto:example@example.com',
84
102
  },
@@ -95,16 +113,19 @@ describe('reference utilities', () => {
95
113
  const expected = [
96
114
  'This is a test ',
97
115
  {
116
+ __type: 'link',
98
117
  title: 'ClassName',
99
118
  url: '/api/ClassName.html',
100
119
  },
101
120
  ', and ',
102
121
  {
122
+ __type: 'link',
103
123
  title: 'AnotherClass',
104
124
  url: '/api/AnotherClass.html',
105
125
  },
106
126
  ', and an email ',
107
127
  {
128
+ __type: 'link',
108
129
  title: 'testerson',
109
130
  url: 'mailto:testerson',
110
131
  },
@@ -4,38 +4,41 @@ import {
4
4
  RenderableClass,
5
5
  RenderableEnum,
6
6
  RenderableInterface,
7
- Renderable,
8
7
  RenderableSection,
9
8
  GroupedMember,
10
- } from '../core/renderable/types';
11
- import { adaptDescribable, adaptDocumentable } from './documentables';
12
- import { GetRenderableContentByTypeName } from './references';
13
- import {
14
9
  ClassMirrorWithInheritanceChain,
15
10
  FieldMirrorWithInheritance,
16
11
  PropertyMirrorWithInheritance,
17
- } from '../model/inheritance';
12
+ GetRenderableContentByTypeName,
13
+ } from './types';
14
+ import { adaptDescribable, adaptDocumentable } from './documentables';
18
15
  import { adaptConstructor, adaptMethod } from './methods-and-constructors';
19
16
  import { adaptFieldOrProperty } from './fields-and-properties';
20
17
 
21
- export function typeToRenderableType(
22
- type: Type,
18
+ type GetReturnRenderable<T extends Type> = T extends InterfaceMirror
19
+ ? RenderableInterface
20
+ : T extends ClassMirror
21
+ ? RenderableClass
22
+ : RenderableEnum;
23
+
24
+ export function typeToRenderable<T extends Type>(
25
+ type: T,
23
26
  linkGenerator: GetRenderableContentByTypeName,
24
27
  namespace?: string,
25
- ): Renderable {
26
- function getRenderable() {
28
+ ): GetReturnRenderable<T> {
29
+ function getRenderable(): RenderableInterface | RenderableClass | RenderableEnum {
27
30
  switch (type.type_name) {
28
31
  case 'enum':
29
- return enumTypeToEnumSource(type as EnumMirror, linkGenerator);
32
+ return enumTypeToEnumSource(type as EnumMirror, linkGenerator) as RenderableEnum;
30
33
  case 'interface':
31
- return interfaceTypeToInterfaceSource(type as InterfaceMirror, linkGenerator);
34
+ return interfaceTypeToInterfaceSource(type as InterfaceMirror, linkGenerator) as RenderableInterface;
32
35
  case 'class':
33
- return classTypeToClassSource(type as ClassMirrorWithInheritanceChain, linkGenerator);
36
+ return classTypeToClassSource(type as ClassMirrorWithInheritanceChain, linkGenerator) as RenderableClass;
34
37
  }
35
38
  }
36
39
 
37
40
  return {
38
- ...getRenderable(),
41
+ ...(getRenderable() as GetReturnRenderable<T>),
39
42
  namespace,
40
43
  };
41
44
  }
@@ -85,7 +88,7 @@ function enumTypeToEnumSource(
85
88
  };
86
89
  }
87
90
 
88
- export function interfaceTypeToInterfaceSource(
91
+ function interfaceTypeToInterfaceSource(
89
92
  interfaceType: InterfaceMirror,
90
93
  linkGenerator: GetRenderableContentByTypeName,
91
94
  baseHeadingLevel: number = 1,
@@ -1,6 +1,6 @@
1
- import { CustomTag, RenderableDocumentation, RenderableContent } from '../core/renderable/types';
2
- import { Describable, Documentable } from './types';
3
- import { GetRenderableContentByTypeName, replaceInlineReferences } from './references';
1
+ import { CustomTag, RenderableDocumentation, RenderableContent, CodeBlock } from './types';
2
+ import { Describable, Documentable, GetRenderableContentByTypeName } from './types';
3
+ import { replaceInlineReferences } from './inline';
4
4
  import { isEmptyLine } from './type-utils';
5
5
 
6
6
  export function adaptDescribable(
@@ -14,15 +14,46 @@ export function adaptDescribable(
14
14
  return;
15
15
  }
16
16
 
17
- return (
18
- describable
19
- .map<RenderableContent[]>((line) => [
20
- ...replaceInlineReferences(line, linkGenerator),
17
+ let content: RenderableContent[] = [];
18
+ for (let i = 0; i < describable.length; i++) {
19
+ const line = describable[i];
20
+ // The language might or might not be present after ```
21
+ const codeBlockMatch = line.match(/^```([a-zA-Z]*)$/);
22
+ if (codeBlockMatch) {
23
+ // Check if the language is present, if not, fallback to "apex"
24
+ const language = codeBlockMatch[1] || 'apex';
25
+ const codeBlockLines: string[] = [];
26
+ i++;
27
+ while (i < describable.length) {
28
+ const currentLine = describable[i];
29
+ if (currentLine.trim() === '```') {
30
+ break;
31
+ }
32
+ codeBlockLines.push(currentLine);
33
+ i++;
34
+ }
35
+ content = [
36
+ ...content,
21
37
  {
22
- type: 'empty-line',
38
+ __type: 'code-block',
39
+ language,
40
+ content: codeBlockLines,
23
41
  },
24
- ])
25
- .flatMap((line) => line)
42
+ { __type: 'empty-line' },
43
+ ];
44
+ continue;
45
+ }
46
+
47
+ content = [
48
+ ...content,
49
+ ...replaceInlineReferences(line, linkGenerator),
50
+ {
51
+ __type: 'empty-line',
52
+ },
53
+ ];
54
+ }
55
+ return (
56
+ content
26
57
  // If the last element is an empty line, remove it
27
58
  .filter((line, index, lines) => !(isEmptyLine(line) && index === lines.length - 1))
28
59
  );
@@ -71,6 +102,17 @@ export function adaptDocumentable(
71
102
  );
72
103
  }
73
104
 
105
+ function bodyLinesToCodeBlock(language: string, bodyLines: string[] | undefined): CodeBlock | undefined {
106
+ if (!bodyLines) {
107
+ return;
108
+ }
109
+ return {
110
+ __type: 'code-block',
111
+ language,
112
+ content: bodyLines,
113
+ };
114
+ }
115
+
74
116
  return {
75
117
  ...adaptDescribable(documentable.docComment?.descriptionLines, linkGenerator),
76
118
  annotations: documentable.annotations.map((annotation) => annotation.type.toUpperCase()),
@@ -78,12 +120,12 @@ export function adaptDocumentable(
78
120
  mermaid: {
79
121
  headingLevel: subHeadingLevel,
80
122
  heading: 'Diagram',
81
- value: extractAnnotationBodyLines(documentable, 'mermaid'),
123
+ value: bodyLinesToCodeBlock('mermaid', extractAnnotationBodyLines(documentable, 'mermaid')),
82
124
  },
83
125
  example: {
84
126
  headingLevel: subHeadingLevel,
85
127
  heading: 'Example',
86
- value: documentable.docComment?.exampleAnnotation?.bodyLines,
128
+ value: bodyLinesToCodeBlock('apex', documentable.docComment?.exampleAnnotation?.bodyLines),
87
129
  },
88
130
  group: extractAnnotationBody(documentable, 'group'),
89
131
  author: extractAnnotationBody(documentable, 'author'),
@@ -1,21 +1,28 @@
1
- import { FieldMirrorWithInheritance, PropertyMirrorWithInheritance } from '../model/inheritance';
2
- import { RenderableField } from '../core/renderable/types';
1
+ import {
2
+ CodeBlock,
3
+ FieldMirrorWithInheritance,
4
+ PropertyMirrorWithInheritance,
5
+ RenderableField,
6
+ GetRenderableContentByTypeName,
7
+ } from './types';
3
8
  import { adaptDocumentable } from './documentables';
4
- import { GetRenderableContentByTypeName } from './references';
5
9
 
6
10
  export function adaptFieldOrProperty(
7
11
  field: FieldMirrorWithInheritance | PropertyMirrorWithInheritance,
8
12
  linkGenerator: GetRenderableContentByTypeName,
9
13
  baseHeadingLevel: number,
10
14
  ): RenderableField {
11
- function buildSignature() {
15
+ function buildSignature(): CodeBlock {
12
16
  const { access_modifier, name } = field;
13
17
  const memberModifiers = field.memberModifiers.join(' ');
14
- return (
15
- `${access_modifier} ${memberModifiers} ${name}`
16
- // remove double spaces
17
- .replace(/ {2}/g, ' ')
18
- );
18
+ const codeContents = `${access_modifier} ${memberModifiers} ${name}`
19
+ // remove double spaces
20
+ .replace(/ {2}/g, ' ');
21
+ return {
22
+ __type: 'code-block',
23
+ language: 'apex',
24
+ content: [codeContents],
25
+ };
19
26
  }
20
27
 
21
28
  return {
@@ -32,7 +39,7 @@ export function adaptFieldOrProperty(
32
39
  signature: {
33
40
  headingLevel: baseHeadingLevel + 1,
34
41
  heading: 'Signature',
35
- value: [buildSignature()],
42
+ value: buildSignature(),
36
43
  },
37
44
  };
38
45
  }