Skip to content

Commit db6d277

Browse files
authored
privatize annotated string API, take two (#55845)
#55453 is stuck on StyledStrings and Base documentation being entangled and there isn't a good way to have the documentation of Base types / methods live in an stdlib. This is a stop gap solution to finally be able to move forwards with 1.11.
1 parent 9f1c068 commit db6d277

File tree

4 files changed

+18
-26
lines changed

4 files changed

+18
-26
lines changed

base/public.jl

-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@ public
2121
ImmutableDict,
2222
OneTo,
2323
LogRange,
24-
AnnotatedString,
25-
AnnotatedChar,
2624
UUID,
2725

28-
# Annotated strings
29-
annotatedstring,
30-
annotate!,
31-
annotations,
32-
3326
# Semaphores
3427
Semaphore,
3528
acquire,

base/strings/annotated.jl

-14
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ the combined range.
3939
See also [`AnnotatedChar`](@ref), [`annotatedstring`](@ref),
4040
[`annotations`](@ref), and [`annotate!`](@ref).
4141
42-
!!! warning
43-
While the constructors are part of the Base public API, the fields
44-
of `AnnotatedString` are not. This is to allow for potential future
45-
changes in the implementation of this type. Instead use the
46-
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
47-
functions.
48-
4942
# Constructors
5043
5144
```julia
@@ -81,13 +74,6 @@ More specifically, this is a simple wrapper around any other
8174
See also: [`AnnotatedString`](@ref), [`annotatedstring`](@ref), `annotations`,
8275
and `annotate!`.
8376
84-
!!! warning
85-
While the constructors are part of the Base public API, the fields
86-
of `AnnotatedChar` are not. This it to allow for potential future
87-
changes in the implementation of this type. Instead use the
88-
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
89-
functions.
90-
9177
# Constructors
9278
9379
```julia

doc/src/base/strings.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ Core.String(::AbstractString)
1717
Base.SubString
1818
Base.LazyString
1919
Base.@lazy_str
20-
Base.AnnotatedString
21-
Base.AnnotatedChar
22-
Base.annotatedstring
23-
Base.annotations
24-
Base.annotate!
2520
Base.transcode
2621
Base.unsafe_string
2722
Base.ncodeunits(::AbstractString)
@@ -101,3 +96,17 @@ Base.escape_string
10196
Base.escape_raw_string
10297
Base.unescape_string
10398
```
99+
100+
## `AnnotatedString`s
101+
102+
!!! note
103+
The API for AnnotatedStrings is considered experimental and is subject to change between
104+
Julia versions.
105+
106+
```@docs
107+
Base.AnnotatedString
108+
Base.AnnotatedChar
109+
Base.annotatedstring
110+
Base.annotations
111+
Base.annotate!
112+
```

doc/src/manual/strings.md

+4
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,10 @@ last backslash escapes a quote, since these backslashes appear before a quote.
12071207

12081208
## [Annotated Strings](@id man-annotated-strings)
12091209

1210+
!!! note
1211+
The API for AnnotatedStrings is considered experimental and is subject to change between
1212+
Julia versions.
1213+
12101214
It is sometimes useful to be able to hold metadata relating to regions of a
12111215
string. A [`AnnotatedString`](@ref Base.AnnotatedString) wraps another string and
12121216
allows for regions of it to be annotated with labelled values (`:label => value`).

0 commit comments

Comments
 (0)