Skip to content

Commit d503ab0

Browse files
committed
add information about help mode for variables with metadata
1 parent c55e43a commit d503ab0

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

docs/src/basics/Variable_metadata.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Symbolic metadata
2-
It is possible to add metadata to symbolic variables. The following
3-
information can be added (note, it's possible to extend this to user-defined metadata as well)
2+
It is possible to add metadata to symbolic variables, the metadata will be displayed when calling help on a variable.
3+
4+
The following information can be added (note, it's possible to extend this to user-defined metadata as well)
45

56
## Variable descriptions
67
Descriptive strings can be attached to variables using the `[description = "descriptive string"]` syntax:
@@ -19,6 +20,20 @@ When variables with descriptions are present in systems, they will be printed wh
1920
show(stdout, "text/plain", sys) # hide
2021
```
2122

23+
Calling help on the variable `u` displays the description, alongside other metadata:
24+
```julia
25+
help?> u
26+
27+
A variable of type Symbolics.Num (Num wraps anything in a type that is a subtype of Real)
28+
29+
Metadata
30+
≡≡≡≡≡≡≡≡≡≡
31+
32+
ModelingToolkit.VariableDescription: This is my input
33+
34+
Symbolics.VariableSource: (:variables, :u)
35+
```
36+
2237
## Input or output
2338
Designate a variable as either an input or an output using the following
2439
```@example metadata

src/variables.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,3 @@ end
286286
function hasdescription(x)
287287
getdescription(x) != ""
288288
end
289-
290-
function Base.Docs.getdoc(p::Num)
291-
string(Base.Docs.@doc(p), " ", getdescription(p))
292-
end

0 commit comments

Comments
 (0)