Skip to content

Conversation

@AndreiKingsley
Copy link
Contributor

No description provided.

@Jolanrensen
Copy link
Collaborator

For visibility, we'd need to merge this with https://github.com/Kotlin/dataframe/blob/master/KDOC_PREPROCESSING.md#kodex-conventions-in-dataframe. It may be okay to have two documents:

  • Kdoc preprocessing
  • Documenting guide

but they should probably link to each other. A single document could also work


We use [KoDEx](https://github.com/Jolanrensen/KoDEx) KDocs preprocessor.
It adds several useful utilities for writing KDocs. Please read about
the [KoDEx notation](https://github.com/Jolanrensen/KoDEx/wiki/Notation) before working with Kotlin DataFrame KDocs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the other doc. The one in DataFrame contains more practical information, whereas the KoDEx one is more generic

One of the best utilities of KoDEx is the ability to reuse common parts of KDocs.
This can be done by using the
[`@include` tag](https://github.com/Jolanrensen/KoDEx/wiki/Notation#include-including-content-from-other-kdocs),
which allows you to include a KDoc of another class.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*another documentable element. Can be a class, interface, type alias, etc.

[`@include` tag](https://github.com/Jolanrensen/KoDEx/wiki/Notation#include-including-content-from-other-kdocs),
which allows you to include a KDoc of another class.

There are a lot of interfaces in the project that are only used for including their KDocs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I call those "documentation interfaces". (Though I don't know what to call them when they become type aliases... maybe just "Documentation element"?)

Important to mention is that a documentation interface that a user should be able to reach should nót be excluded.

relevant mention
https://github.com/Kotlin/dataframe/blob/master/KDOC_PREPROCESSING.md#excludefromsources-annotation-excluding-code-content-from-sources

Copy link
Contributor Author

@AndreiKingsley AndreiKingsley Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so my naming proposal:

  1. All exlcuded typealias ..= Nothing or interfaces we use for @include - "KDoc snippets" (or "KDoc fragments").
  2. Not excluded empty entities we use as "topics" we refer to in KDocs (but do not include them) - KDoc navigation anchors.

And let's rename all the entities accordingly:
SelectingColumns - > SelectingColumnsAnchor
RowFilterDescription -> RowFilterSnippet

I believe this will significantly improve KDocs helpers (yeah, I call it like that 😄) structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The general one - "KDoc helpers"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"KDoc Snippet" makes sense :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the "Anchor" name, because it's what users will see when they click on it. Ideally the name of 'topics' should just be the title of the topic. AKA interface NaN describes the concept NaN in its KDoc. Maybe these could remain nameless, or follow the backtick convention like for tests, indicating that we see the name of the interface/alias as a title and not something to program with.

Copy link
Contributor Author

@AndreiKingsley AndreiKingsley Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that we give those "placeholder" entities actually meaningful names without highlighting that they are actually dummy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I understand... But what do you think of something like:

public interface `DSL Grammar`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do you mean "to put all of those entity definitions into backticks"?
It could work!

[`ColumnPathCreation` interface](https://github.com/Kotlin/dataframe/blob/master/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/ColumnPathCreation.ktc)
has a KDoc which describes column path creation behavior. The whole file is excluded from sources,
but the KDoc is included in other KDocs.
z
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z

but the KDoc is included in other KDocs.
z
Also, you can use
[`@set` and `@get` tags](https://github.com/Jolanrensen/KoDEx/wiki/Notation#set-and-get---setting-and-getting-variables)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know it! That's cool, but on the other hand, I'd like to all KoDEx specific stuff starts with @ so user understands where this comes from.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but then again, not áll @ are KoDEx, some are just Kotlin ;P in any case, you'll need the intellij plugin to highlight it correctly, and it'll pickup $ as well :)

Some part of public API is not intended for end users, but can be used in Compiler Plugin or potential
KDF extension libraries. These methods should have a small KDocs as well.

For internal API, please add at least a small note.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or anything you wished was there if someone else wrote the function and you had to use and understand it ;P


## Kotlin DataFrame Operations KDoc Structure

Operation KDocs size and structure completely depend on the operation complexity.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy, soldier! Operation KDocs is a GO! :D

* For a better understanding of the complex operation, we write an [operation grammar](#grammar) using a
[special notation](https://github.com/Kotlin/dataframe/blob/master/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DslGrammar.kt).
Add a reference to the operation Grammar in each related class and method KDoc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. operation that are called on columns

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, such operations usually are of the first kind.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, yes, you're right :)

* {@comment Version of [SelectingColumns] with correctly filled in examples}
* @include [SelectingColumns] {@include [Set~OperationName~OperationArg]}
*/
interface ~OperationName~Options
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gonna be a typealias ~OperationName~Options = Nothing after 2.3.

// Set operation in [SelectingColumns] examples (in [SelectingColumns.Dsl] and so on)
/** {@set [SelectingColumns.OPERATION] [~operationName~][~operation~]} */
@ExcludeFromSources
private interface Set~OperationName~OperationArg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be a type alias too. It's fine for now like this, but we should change it later :)

// `SelectingColumns` helper KDoc with this operation in examples
// - for operations with columns selection
/**
* {@comment Version of [SelectingColumns] with correctly filled in examples}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary {}. @comment ends when @include begins

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are only needed when you want to use a tag inline

}

// Set operation in [SelectingColumns] examples (in [SelectingColumns.Dsl] and so on)
/** {@set [SelectingColumns.OPERATION] [~operationName~][~operation~]} */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary {}


// Common KDoc part for different overloads of the same method
/**
* {@include [~OperationName~Docs]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants