Skip to content

Commit

Permalink
Prepare release 0.6.0, with starlark_doc_extract and HTML formatting …
Browse files Browse the repository at this point in the history
…supported (#171)
  • Loading branch information
tetromino authored Aug 3, 2023
1 parent af19cfe commit 00b171f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
87 changes: 87 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,90 @@
## Release 0.6.0

**New Features**

- Stardoc no longer escapes HTML tags in documentation. Feel free to
use HTML formatting in your docs! We now also have much-improved
rendering for fenced code blocks in attribute docs, and render attribute
default values using Markdown instead of HTML markup. (#161, #167)
- Stardoc now dedents and trims all doc strings - not only in macros (#170).
This means you can have

```bzl
my_rule = rule(
doc = """
This is my rule.
Here is more info about it.
...
""",
...
)
```

and Stardoc will dedent and trim the doc to

```
This is my rule.

Here is more info about it.

...
```
- When using Bazel 7 or newer (or current Bazel HEAD), Stardoc will by
default use the native `starlark_doc_extract` rule internally (#166).

This means, in particular:
* correct default values for rule attributes in all cases
* documentation for module extensions
* more complete documentation for repository rules
* by default (this can be turned off via `render_main_repo_name = False`),
we will render labels in your main repo with a repo component: your
main module name (when using bzlmod) or WORKSPACE name (#168).

You may temporarily disable the new extractor by calling Stardoc with
`use_starlark_doc_extract = False`. However, after Bazel 7 is released,
we plan to remove this argument and always use the new extractor.

**Incompatible Changes**

- The Markdown renderer now uses Google EscapeVelocity instead of Apache
Velocity for templating. The templating engines are _almost_ compatible,
with the exception of escapes in string literals: if in your template you
had a string literal with a character escape, you would need to expand it.

For example, instead of

```velocity
${funcInfo.docString.replaceAll("\n", " ")}
```

you would need

```velocity
${funcInfo.docString.replaceAll("
", " ")}
```
- When using the native `starlark_doc_extract` extractor, Stardoc requires
two additional templates: `repository_rule_template` and
`module_extension_template`. If you are using custom templates, you will
probably want to define these, following the examples in
`stardoc/templates/markdown_tables`.
- When using the native `starlark_doc_extract` extractor, Stardoc cannot
document generated .bzl files any more - because Bazel cannot `load()`
generated .bzl files.

**Other Notable Changes**

- The Markdown renderer's source now lives in the Stardoc repo; we build the
renderer from source instead of using a bundled jar. Unfortunately, if you
are not using bzlmod, this requires a rather complicated WORKSPACE setup;
see https://github.com/bazelbuild/stardoc/releases/tag/0.6.0

**Contributors**

Alexandre Rostovtsev, Fabian Meumertzheim

## Release 0.5.6 (initially tagged as 0.5.5)

Bugfix release: update `@rules_java` dependency to fix breakage with Bazel at HEAD.
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "stardoc",
version = "0.5.6",
version = "0.6.0",
compatibility_level = 1,
)

Expand Down
2 changes: 1 addition & 1 deletion version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
"""The version of Stardoc."""

version = "0.5.6"
version = "0.6.0"

0 comments on commit 00b171f

Please sign in to comment.