Skip to content
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

[WIP] Enhance attribute docs #334

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
61 changes: 42 additions & 19 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function make_attr_df(ktype::Symbol, defs::KW)

aliases = sort(collect(keys(filter(p -> p.second == k, Plots._keyAliases))))
df.Attribute[i] = string(k)
df.Aliases[i] = join(aliases, ", ")
df.Aliases[i] = join(aliases, " ")
df.Default[i] = show_default(def)
df.Type[i] = string(type)
df.Description[i] = string(desc)
Expand All @@ -326,14 +326,13 @@ show_default(x::Symbol) = surround_backticks(":$x")

function generate_attr_markdown(c)
attribute_texts = Dict(
:Series => "These attributes apply to individual series (lines, scatters, heatmaps, etc)",
:Plot => "These attributes apply to the full Plot. (A Plot contains a tree-like layout of Subplots)",
:Subplot => "These attributes apply to settings for individual Subplots.",
:Series => "Series attributes apply to individual series, such as lines, scatters, heatmaps, etc. The detailed documentation may also contain a list of series types for which the given attribute is relevant.",
:Plot => "A Plot contains a tree-like layout of Subplots. These attributes apply to the full Plot.",
:Subplot => "These attributes apply to settings for individual Subplots. These include attributes related to annotations, colorbars, legends, margins, and titles, as well as a few others.",
:Axis => """
These attributes apply by default to all Axes in a Subplot (for example the `subplot[:xaxis]`).
These attributes apply by default to all Axes in a Subplot (for example, the `subplot[:xaxis]`).
!!! info
You can also specific the x, y, or z axis for each of these attributes by prefixing the attribute name with x, y, or z
(for example `xmirror` only sets the mirror attribute for the x axis).
For all attributes on this page, you can specify the x, y, or z-axis for each of these attributes by prefixing the attribute name with x, y, or z. For example, `xmirror` only sets the mirror attribute for the x-axis.
""",
)
attribute_defaults = Dict(
Expand All @@ -352,17 +351,39 @@ function generate_attr_markdown(c)
```@meta
EditURL = "$(edit_url())"
```
### $c
# $c Attributes

$(attribute_texts[c])

```@raw html
$(to_html(df))
```
## Contents

$(autogenerated())
"""
)
| Attribute | Aliases |
| :-------- | :------ |
""")
for row in eachrow(df)
write(md, """
| [`$(row.Attribute)`](@ref $(cstr)_$(row.Attribute)) | $(row.Aliases) |
""")
end
write(md, """
## Documentation

""")
for row in eachrow(df)
write(md, """
### [$(row.Attribute)](@id $(cstr)_$(row.Attribute))
```julia
$(row.Attribute) :: $(row.Type)
```
**Aliases:** $(row.Aliases)

Defaults to $(row.Default).

$(row.Description)

""")
end
write(md, "$(autogenerated())")
end
end

Expand Down Expand Up @@ -656,14 +677,17 @@ function main()
"Histograms" => "series_types/histogram.md",
],
],
"Manual" => [
"Input Data" => "input_data.md",
"Output" => "output.md",
"Attributes" => "attributes.md",
"Attributes" => [
"Introduction" => "Attributes/attributes.md",
"Series Attributes" => "generated/attributes_series.md",
"Plot Attributes" => "generated/attributes_plot.md",
"Subplot Attributes" => "generated/attributes_subplot.md",
"Axis Attributes" => "generated/attributes_axis.md",
"Supported Attributes" => "generated/supported.md",
],
"Manual" => [
"Input Data" => "input_data.md",
"Output" => "output.md",
"Layouts" => "layouts.md",
"Recipes" => [
"Overview" => "recipes.md",
Expand All @@ -684,7 +708,6 @@ function main()
"Animations" => "animations.md",
"Themes" => "generated/plotthemes.md",
"Backends" => "backends.md",
"Supported Attributes" => "generated/supported.md",
],
"Learning" => "learning.md",
"Contributing" => "contributing.md",
Expand Down
File renamed without changes.