ballerina-platform / ballerina-central

Ballerina Central Website
Apache License 2.0
106 stars 1 forks source link

Use the package.json of BALA files to render package and module documentations #159

Open azinneera opened 1 month ago

azinneera commented 1 month ago

Description: Related lang issue: https://github.com/ballerina-platform/ballerina-lang/issues/42981

With these changes, the package.json of the BALA will be added with the "docs" field as shown below. BC can read this entry and render the documentation.

{
  "organization": "asmaj",
  "name": "readmeTest",
  "version": "0.1.0",
  "export": [
    "readmeTest"
  ],
  "docs": {
    "readmeTest.mod1": "docs/readmeTest.mod1/Module.md", // Optional. pattern- "<moduleName>" : "<docPath>"
    "readmeTest": "docs/Package.md" // Mandatory. pattern- "<packageName>" : "<docPath>"
  },
  "ballerina_version": "2201.10.0-SNAPSHOT",
  "implementation_vendor": "WSO2",
  "language_spec_version": "2024R1",
  "platform": "any",
  "graalvmCompatible": true,
  "template": false
}

Note: With the new structure, documentation for the default module is also expected to be contained in the package documentation MD file. Therefore, the Module.md of the default module will not be packaged into the BALA.

tharindu-nw commented 1 month ago

We render the package content in Ballerina Central using the description field in the api-doc.json file generated by org.ballerinalang.docgen.docs.BallerinaDocGenerator (same as bal doc command). This change should be added to that class in lang.