Skip to content

Commit

Permalink
privatize annotated string API, take two (#55845)
Browse files Browse the repository at this point in the history
#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.

(cherry picked from commit db6d277)
  • Loading branch information
KristofferC authored and aviatesk committed Sep 24, 2024
1 parent 9e82e60 commit 056a287
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
7 changes: 0 additions & 7 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1096,15 +1096,8 @@ public
Lockable,
OneTo,
LogRange,
AnnotatedString,
AnnotatedChar,
UUID,

# Annotated strings
annotatedstring,
annotate!,
annotations,

# Semaphores
Semaphore,
acquire,
Expand Down
14 changes: 0 additions & 14 deletions base/strings/annotated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ the combined range.
See also [`AnnotatedChar`](@ref), [`annotatedstring`](@ref),
[`annotations`](@ref), and [`annotate!`](@ref).
!!! warning
While the constructors are part of the Base public API, the fields
of `AnnotatedString` are not. This is to allow for potential future
changes in the implementation of this type. Instead use the
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
functions.
# Constructors
```julia
Expand Down Expand Up @@ -81,13 +74,6 @@ More specifically, this is a simple wrapper around any other
See also: [`AnnotatedString`](@ref), [`annotatedstring`](@ref), `annotations`,
and `annotate!`.
!!! warning
While the constructors are part of the Base public API, the fields
of `AnnotatedChar` are not. This it to allow for potential future
changes in the implementation of this type. Instead use the
[`annotations`](@ref), and [`annotate!`](@ref) getter/setter
functions.
# Constructors
```julia
Expand Down
19 changes: 14 additions & 5 deletions doc/src/base/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ Core.String(::AbstractString)
Base.SubString
Base.LazyString
Base.@lazy_str
Base.AnnotatedString
Base.AnnotatedChar
Base.annotatedstring
Base.annotations
Base.annotate!
Base.transcode
Base.unsafe_string
Base.ncodeunits(::AbstractString)
Expand Down Expand Up @@ -98,3 +93,17 @@ Base.escape_string
Base.escape_raw_string
Base.unescape_string
```

## `AnnotatedString`s

!!! note
The API for AnnotatedStrings is considered experimental and is subject to change between
Julia versions.

```@docs
Base.AnnotatedString
Base.AnnotatedChar
Base.annotatedstring
Base.annotations
Base.annotate!
```
4 changes: 4 additions & 0 deletions doc/src/manual/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,10 @@ last backslash escapes a quote, since these backslashes appear before a quote.

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

!!! note
The API for AnnotatedStrings is considered experimental and is subject to change between
Julia versions.

It is sometimes useful to be able to hold metadata relating to regions of a
string. A [`AnnotatedString`](@ref Base.AnnotatedString) wraps another string and
allows for regions of it to be annotated with labelled values (`:label => value`).
Expand Down

0 comments on commit 056a287

Please sign in to comment.