Skip to content

Commit ed7b069

Browse files
Add examples for @text_str and @html_str (#38254)
Co-authored-by: Max Horn <[email protected]>
1 parent 691cf74 commit ed7b069

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

base/docs/utils.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ show(io::IO, ::MIME"text/html", h::HTML{<:Function}) = h.content(io)
4343
@html_str -> Docs.HTML
4444
4545
Create an `HTML` object from a literal string.
46+
47+
# Examples
48+
```jldoctest
49+
julia> html"Julia"
50+
HTML{String}("Julia")
51+
```
4652
"""
4753
macro html_str(s)
4854
:(HTML($s))
@@ -89,6 +95,12 @@ hash(t::T, h::UInt) where {T<:Union{HTML,Text}} = hash(T, hash(t.content, h))
8995
@text_str -> Docs.Text
9096
9197
Create a `Text` object from a literal string.
98+
99+
# Examples
100+
```jldoctest
101+
julia> text"Julia"
102+
Julia
103+
```
92104
"""
93105
macro text_str(s)
94106
:(Text($s))

0 commit comments

Comments
 (0)