Skip to content

Commit

Permalink
adding kdoc preprocessing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Aug 5, 2024
1 parent 1d1cad6 commit c0b9f0a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion KDOC_PREPROCESSING.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,28 @@ like `@file:ExcludeFromSources`.

## KDoc Preprocessor Conventions in DataFrame

TODO

## KDoc -> WriterSide

### `@ExportAsHtml`
There's a special annotation, `@ExportAsHtml`, that allows you to export the content of the KDoc of the annotated
function, interface, or class as HTML.
The MarkDown of the KDoc is rendered to HTML using [JetBrains/markdown](https://github.com/JetBrains/markdown) and, in
the case of DataFrame, put in [./docs/StardustDocs/snippets/kdocs](./docs/StardustDocs/snippets/kdocs).
From there, the HTML can be included in any WriterSide page as an iFrame.
This can be done using our custom `<dataFrame src=""/>` tag.

An example of the result can be found in the
[DataFrame documentation](https://kotlin.github.io/dataframe/columnselectors.html#full-dsl-grammar).

The annotation supports two parameters: `theme`, and `stripReferences`, which both are `true` by default.
When the `theme` argument is `true`, some CSS is added to the HTML output to make it look good in combination with
WriterSide. If the `stripReferences` is `true`, all `[]` references are stripped,
like `[name][fully.qualified.name]` -> `<code>name</code>`. This makes the output a lot more readable since
the references won't be clickable in the HTML output anyway.

Optionally, the tags `@exportAsHtmlStart` and `@exportAsHtmlEnd` can be used to mark the start and end of the content
to be exported as HTML.
This is useful when you only want to export a part of the KDoc.

`@ExportAsHtml` can also safely be used in combination with `@ExcludeFromSources`.

0 comments on commit c0b9f0a

Please sign in to comment.