-
Notifications
You must be signed in to change notification settings - Fork 78
Documentation guidelines #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Documentation guidelines #1660
Conversation
|
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:
but they should probably link to each other. A single document could also work |
docs/KDocs-Guidelines.md
Outdated
|
|
||
| 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. |
There was a problem hiding this comment.
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
docs/KDocs-Guidelines.md
Outdated
| 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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
- All exlcuded
typealias ..= Nothingor interfaces we use for@include- "KDoc snippets" (or "KDoc fragments"). - 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.
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"KDoc Snippet" makes sense :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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`There was a problem hiding this comment.
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!
docs/KDocs-Guidelines.md
Outdated
| [`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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- operation that are called on columns
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
docs/KDocs-Guidelines.md
Outdated
| * {@comment Version of [SelectingColumns] with correctly filled in examples} | ||
| * @include [SelectingColumns] {@include [Set~OperationName~OperationArg]} | ||
| */ | ||
| interface ~OperationName~Options |
There was a problem hiding this comment.
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.
docs/KDocs-Guidelines.md
Outdated
| // Set operation in [SelectingColumns] examples (in [SelectingColumns.Dsl] and so on) | ||
| /** {@set [SelectingColumns.OPERATION] [~operationName~][~operation~]} */ | ||
| @ExcludeFromSources | ||
| private interface Set~OperationName~OperationArg |
There was a problem hiding this comment.
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 :)
docs/KDocs-Guidelines.md
Outdated
| // `SelectingColumns` helper KDoc with this operation in examples | ||
| // - for operations with columns selection | ||
| /** | ||
| * {@comment Version of [SelectingColumns] with correctly filled in examples} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
docs/KDocs-Guidelines.md
Outdated
| } | ||
|
|
||
| // Set operation in [SelectingColumns] examples (in [SelectingColumns.Dsl] and so on) | ||
| /** {@set [SelectingColumns.OPERATION] [~operationName~][~operation~]} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary {}
docs/KDocs-Guidelines.md
Outdated
|
|
||
| // Common KDoc part for different overloads of the same method | ||
| /** | ||
| * {@include [~OperationName~Docs]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary {}
No description provided.