Skip to content

Commit 311ff28

Browse files
Contribute section with Mermaid schemas and more structured approach (#2)
* docs(contribute): Update small and medium/large on main contribute page. Update small library page * docs(contribute): Harmonize section titles for Medium/Large library workflow and structure * docs(contribute): UpdateSmall Library Structure structure to include version directories * feat(docs): contribute - Updated medium/large library - fixes/enhancement to contribute and small library * fix(config): correct privacy URL in configuration file * doc(contribute): Added Doc Site page, removed emoji, reduce number of info boxes * Refactor code structure for aligning to defined standards
1 parent 1600c54 commit 311ff28

11 files changed

Lines changed: 382 additions & 137 deletions

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ company: SQLBI Corp.
77
web_url: https://daxlib.org
88

99
# Privacy URL - It's added to the website footer
10-
privacy_url: https://docs.daxlib.org/terms/policy
10+
privacy_url: https://docs.daxlib.org/terms/privacy
1111

1212
# Terms URL - It's added to the website footer
1313
terms_url: https://docs.daxlib.org/terms

_mydocs/contribute/doc-sites.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
layout: page
3+
title: Documentation Sites
4+
menu_title: Documentation Sites
5+
published: true
6+
date: 2025-10-28
7+
modified: 2025-10-28
8+
order: /06
9+
next_reading: true
10+
---
11+
12+
DAX Lib supports including a `README.md` file with your library to provide documentation, which will be displayed alongside your library on [daxlib.org](https://daxlib.org/). For smaller libraries, this is typically sufficient.
13+
14+
As your library grows, you may want a dedicated documentation website with better organization, search functionality, and examples. You can specify your documentation site URL in the `manifest.daxlib` file:
15+
16+
```json
17+
{
18+
// ...other properties...
19+
"projectUrl": "https://yourusername.github.io/your-library/"
20+
}
21+
```
22+
23+
## Hosting Options
24+
25+
There are many options for hosting documentation websites. A popular choice is [GitHub Pages](https://docs.github.com/en/pages), which is:
26+
27+
- **Free** for public repositories
28+
- **Integrated** with GitHub repositories
29+
- **Automatic** - deploys from your repo
30+
- **Custom domains** - supports your own domain name
31+
32+
GitHub Pages hosts static websites (HTML, CSS, and JavaScript files) directly from your repository.
33+
34+
## Static Site Generators (SSG)
35+
36+
While you can manually create HTML files, **Static Site Generators (SSG)** make documentation much easier. SSGs convert markdown files and templates into a complete website at build time.
37+
38+
**Benefits:**
39+
- Write content in simple markdown (`.md` files)
40+
- Use themes for professional-looking sites
41+
- Built-in features like search, navigation, and versioning
42+
- No database or server required
43+
44+
### Popular SSG Options
45+
46+
| SSG | Language | Why Choose It |
47+
|-----|----------|---------------|
48+
| **Jekyll** | Ruby | **Native GitHub Pages support** - zero configuration deployment. Officially supported by GitHub Pages. |
49+
| **Hugo** | Go | **Extremely fast builds** - ideal for large documentation sites with hundreds of pages. |
50+
| **MkDocs** | Python | **Documentation-focused** - simple configuration, designed specifically for docs. Works great with the Material theme. |
51+
| **Docusaurus** | React | **Feature-rich** - built by Meta for open-source docs. Includes versioning, search, and i18n out of the box. |
52+
53+
> **GitHub Pages & Jekyll:** GitHub Pages has built-in Jekyll support. When you push to your repository, GitHub automatically runs `jekyll build` and deploys your site. Other SSGs require a [GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow) to build the site before deployment.
54+
55+
## Example: daxlib.svg Documentation
56+
57+
The `daxlib.svg` library uses **Material for MkDocs** to generate its documentation site.
58+
59+
<a href="https://evaluationcontext.github.io/daxlib.svg/" class="button" target="_blank">View Documentation Site</a> <a href="https://github.com/EvaluationContext/daxlib.svg" class="button button-alt" target="_blank">View Repository</a>
60+
61+
For a step-by-step guide on building a similar site, see this [blog post](https://evaluationcontext.github.io/posts/DaxLibContribute/#adding-a-docs-site).
62+
63+
![daxlib.svg documentation site](images/doc-site.png)
64+
65+
## Getting Started
66+
67+
1. **Choose an SSG** based on your familiarity with the language and needs
68+
2. **Follow the SSG's documentation** to set up your project structure
69+
3. **Write your documentation** in markdown files
70+
4. **Configure GitHub Pages** in your repository settings
71+
5. **Add the site URL** to your `manifest.daxlib` under `projectUrl`
72+
73+
> For Medium/Large libraries, you can keep your documentation in the same repository as your library code, or create a separate `docs-yourLibrary` repository.

_mydocs/contribute/fork-daxlib.md

Lines changed: 85 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,104 +4,119 @@ title: Contribute Small Libraries to DAX Lib
44
menu_title: Small Libraries
55
published: true
66
date: 2025-10-17
7-
modified: 2025-10-17
7+
modified: 2025-10-28
88
order: /03
99
next_reading: true
1010
---
1111

12-
For small libraries (a few functions), you can follow these steps to add a new package to DAX Lib:
12+
For small libraries (a few functions), you can follow these steps to add a new package to DAX Lib.
1313

14-
1. **Fork** the DAX Lib repository [https://github.com/daxlib/daxlib/fork](https://github.com/daxlib/daxlib/fork).
14+
## **Fork**
15+
16+
Fork the DAX Lib repository:
17+
18+
<a href="https://github.com/daxlib/daxlib/fork" class="button" target="_blank">Fork daxlib/daxlib</a>
1519

16-
This creates a personal copy of the repository in your GitHub account.
20+
This creates a personal copy of the repository in your GitHub account.
21+
22+
> Do not make changes directly on the `main` branch. Always create a separate branch for each change you want to make. For example, `add-my-package-version-1.0.0`. This keeps your work isolated until it's reviewed and approved.
23+
24+
## Create a folder
25+
26+
Create a folder for your package in `/packages/`, following the [naming conventions](naming-conventions.md) for both the folder structure and library name. For a library named `Contoso.Conversion` with version `1.0.0`, the folder structure should be `/packages/c/contoso.conversion/1.0.0/`
1727

18-
**Remarks**:
28+
## Create the package
1929

20-
Do not make changes directly on the `main` branch. Always create a separate branch for each change you want to make. For example, `add-my-package-version-1.0.0`. This keeps your work isolated until it's reviewed and approved.
30+
DAX lib expects a `manifest.daxlib` and `lib/functions.tmdl` files. A `README.md` and `icon.png` can be optionally included.
2131

22-
2. **Create a folder** for your package in `/packages/` and follow the [naming conventions](naming-conventions.md) for both the folder structure and name.
32+
```bash
33+
packages/
34+
├── a/
35+
├── .../
36+
├── c/
37+
│ └── contoso.conversion/
38+
│ └── 1.0.0/
39+
│ ├── lib/
40+
│ │ └── functions.tmdl # Required - Your DAX UDF functions
41+
│ ├── icon.png # Optional - Icon for your library
42+
│ ├── README.md # Optional - Docs for your library
43+
│ └── manifest.daxlib # Required - Declares package properties
44+
├── .../
45+
└── z/
46+
```
2347

24-
You can optionally use the [DaxLib.Sample](https://github.com/daxlib/daxlib/tree/main/packages/d/daxlib.sample/0.1.6) package as a starting point: copy it, rename it according to your librarys name, and then update its contents to match your library.
48+
> You can use the [DaxLib.Sample](https://github.com/daxlib/daxlib/tree/main/packages/d/daxlib.sample/0.1.6) package as a starting point: copy it, rename it according to your library's name, and then update its contents to match your library.
2549
26-
Example: for a library named `Contoso.Conversion` with version `1.0.0`, the folder structure should be:
50+
### manifest.daxlib
2751

28-
```bash
29-
/packages/c/contoso.conversion/1.0.0/
30-
```
31-
32-
3. **Create the manifest** in `manifest.daxlib` file.
33-
34-
The `manifest.daxlib` is a mandatory file contains the package properties in JSON format. You can see the [DaxLib.Sample](https://daxlib.org/package/DaxLib.Sample/#code) package for an example and refer to the [JSON schema](https://github.com/daxlib/daxlib/blob/main/schemas/manifest/1.0.0/manifest.1.0.0.schema.json) for the complete specification of available properties.
52+
*Required:* The package properties in JSON format.
3553

36-
Example: for a library named `Contoso.Conversion` with version `1.0.0`, the manifest file should be located at:
54+
``` json
55+
{
56+
"$schema": "https://raw.githubusercontent.com/sql-bi/daxlib/refs/heads/main/schemas/manifest/1.0.0/manifest.1.0.0.schema.json",
57+
"id": "Contoso.Conversion",
58+
"version": "1.0.0",
59+
"authors": "Contoso",
60+
"description": "My amazing library",
61+
"tags": "DAX,UDF",
62+
"releaseNotes": "New functions", // optional
63+
"projectUrl": "https://contoso.github.io/contoso.conversion/", // optional
64+
"repositoryUrl": "https://github.com/sql-bi/daxlib/tree/main/packages/c/contoso.conversion",
65+
"icon": "/icon.png", // optional
66+
"readme": "/README.md" // optional
67+
}
68+
```
3769

38-
```bash
39-
/packages/c/contoso.conversion/1.0.0/manifest.daxlib
40-
```
70+
Refer to the [JSON schema](https://github.com/daxlib/daxlib/blob/main/schemas/manifest/1.0.0/manifest.1.0.0.schema.json) for the complete specification of available properties. You can also refer to the example [DaxLib.Sample](https://daxlib.org/package/DaxLib.Sample/#code) package.
4171

42-
4. **Create the DAX user-defined functions** in `lib/functions.tmdl` and follow the [naming conventions](naming-conventions.md) for the function names.
72+
### lib/functions.tmdl
4373

44-
The file `lib/functions.tmdl` is a mandatory file and contains the source code of the DAX user-defined functions using the TMDL syntax. For an example, see the [DaxLib.Sample](https://daxlib.org/package/DaxLib.Sample/#code) package.
45-
46-
**Remarks**:
47-
- The `functions.tmdl` file should contain only the function definitions without the `createOrReplace` command.
48-
- Optional: add comments describing the function and its parameters to improve readability and usability, as suggested in the [DAX naming convention](https://docs.sqlbi.com/dax-style/dax-naming-conventions#comments).
49-
- Each UDF must include the mandatory annotations: `DAXLIB_PackageId` and `DAXLIB_PackageVersion`.
74+
*Required:* Contains TMDL definition of the functions within your library. TMDL script must *not* have `CreateOrReplace` keyword.
5075

51-
Example: for a library named `Contoso.Conversion` with version `1.0.0` the annotations should be:
52-
53-
``` text
54-
annotation DAXLIB_PackageId = Contoso.Conversion
55-
annotation DAXLIB_PackageVersion = 1.0.0
56-
```
76+
```dax
77+
/// Convert from Celsius(°C) to Fahrenheit(°F)
78+
/// @param {decimal} temperature – The temperature in Celsius
79+
/// @returns The temperature converted to Fahrenheit
80+
FUNCTION CelsiusToFahrenheit = ( temperature: DOUBLE ) =>
81+
( temperature * ( 9 / 5 ) ) + 32
5782
58-
5. **(Optional) Add a custom icon for your library**
83+
annotation DAXLIB_PackageId = Contoso.Conversion
84+
annotation DAXLIB_PackageVersion = 0.1.0
85+
...
86+
```
5987

60-
You can include a custom icon for your library by adding a PNG file inside the library's folder.
61-
62-
**Remarks**:
63-
- The icon file must be in PNG format (`.PNG`), with a maximum size of 100 KB.
88+
#### Naming Convention
6489

65-
Example: for a library named `Contoso.Conversion` with version `1.0.0`, place the icon file at:
90+
There are some guidelines on DAX UDF naming conventions:
6691

67-
```bash
68-
/packages/c/contoso.conversion/1.0.0/icon.png
69-
```
92+
- [DAX Lib Naming Conventions](https://docs.daxlib.org/contribute/naming-conventions)
93+
- [SQLBI DAX Naming Conventions](https://docs.sqlbi.com/dax-style/dax-naming-conventions)
7094

71-
If you include a library icon, you must also update the `manifest.daxlib` to specify the file path.
95+
#### Annotations
7296

73-
```json
74-
{
75-
// ...other manifest properties...
76-
"icon": "/icon.png"
77-
}
78-
```
97+
Functions must have the following annotations:
7998

80-
6. **(Optional) Add a README file**
99+
```tmdl
100+
annotation DAXLIB_PackageId = <youraccount>/<yourlibrary>
101+
annotation DAXLIB_PackageVersion = x.x.x
102+
```
81103

82-
You can include a README file to provide documentation for your library. It can include general information about the library, usage instructions, examples, and any notes for users.
83-
84-
**Remarks**:
85-
- The file must be in Markdown format (`.MD`), with a maximum size of 100 KB.
86-
- For security reasons, only a limited set of Markdown features are supported, and external links may be restricted to trusted domains.
104+
### icon.png
105+
106+
*Optional:* icon for library
87107

88-
Example: for a library named `Contoso.Conversion` with version `1.0.0`, place the README file at:
108+
The icon file must be in PNG format (.PNG), with a maximum size of 100 KB.
89109

90-
```bash
91-
/packages/c/contoso.conversion/1.0.0/README.md
92-
```
110+
### README.md
111+
112+
*Optional:* Markdown docs file, with general information about the library, usage instructions, examples, and any notes for users
93113

94-
If you include a README file, you must also update the `manifest.daxlib` to specify the file path.
114+
The file must be in Markdown format (.MD), with a maximum size of 100 KB. For security reasons, only a limited set of Markdown features are supported, and external links may be restricted to trusted domains.
95115

96-
```json
97-
{
98-
// ...other manifest properties...
99-
"readme": "/README.md"
100-
}
101-
```
116+
## Submitting Library to DAX Lib
102117

103-
7. **Create a pull request** to publish the library on [daxlib.org](https://daxlib.org/)
118+
Create a pull request from your fork (`<youraccount>/daxlib`) to `daxlib/daxlib` to publish the library on [daxlib.org](https://daxlib.org/). The pull request must be approved manually by DAX Lib owners/maintainers. After approval your library will appear on [DAX Lib](https://daxlib.org/) for other to download and use
104119

105-
- Go [here](https://github.com/daxlib/daxlib/pull/new) to create a new pull request from your forked repository to the official DAX Lib repository.
106-
- The pull request must be approved manually by DAX Lib owners/maintainers.
107-
- When the pull request is approved, the package is immediately published.
120+
> **Packages are immutable**
121+
>
122+
> After a pull request has been accepted, Packages are immutable. If you want to submit any changes to functions or files, a new version (i.e. v0.1.0 à v0.2.0 ) must be created, and function annotations and `manifest.daxlib` must be updated with the new version number. Changes can then be submitted with a new pull request.

0 commit comments

Comments
 (0)