Skip to content

Commit

Permalink
stardoc: Use backtick not <code> for attr default values
Browse files Browse the repository at this point in the history
This is a cherry-pick of bazelbuild/stardoc#143
  • Loading branch information
illicitonion committed Nov 30, 2022
1 parent 6e32fef commit e69bd13
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_stardoc",
sha256 = "aa814dae0ac400bbab2e8881f9915c6f47c49664bf087c409a15f90438d2c23e",
sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
"https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
],
patches = [
# Pull in https://github.com/bazelbuild/stardoc/pull/143
"//:stardoc-attr-default-wrappers.patch",
],
)

Expand Down
23 changes: 23 additions & 0 deletions docs/stardoc-attr-default-wrappers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
commit 677356a2a00a2cb3b10e458c8586a2ea8bd562a4
Author: Daniel Wagner-Hall <dwagnerhall@apple.com>
Date: Wed Nov 30 13:00:47 2022 +0000

Use backtick not `<code>` for attr default values

GitHub Pages doesn't recognise <code> blocks, so renders these
attributes with smart-quotes, which means you can't copy-paste them into
a starlark file.

diff --git stardoc/templates/markdown_tables/func.vm stardoc/templates/markdown_tables/func.vm
index 5275d08..e0d2496 100644
--- stardoc/templates/markdown_tables/func.vm
+++ stardoc/templates/markdown_tables/func.vm
@@ -15,7 +15,7 @@ ${util.htmlEscape($funcInfo.docString)}
| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
#foreach ($param in $funcInfo.getParameterList())
-| <a id="${funcInfo.functionName}-${param.name}"></a>$param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else <p align="center"> - </p> #end | #if(!$param.getDefaultValue().isEmpty()) <code>${util.htmlEscape($param.getDefaultValue())}</code> #else none #end|
+| <a id="${funcInfo.functionName}-${param.name}"></a>$param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else <p align="center"> - </p> #end | #if(!$param.getDefaultValue().isEmpty()) `${util.htmlEscape($param.getDefaultValue())}` #else none #end|
#end
#end
#if (!$funcInfo.getReturn().docString.isEmpty())

0 comments on commit e69bd13

Please sign in to comment.