# Cannot convert DocStr in Julia 1.11

**URL:** <https://discourse.julialang.org/t/cannot-convert-docstr-in-julia-1-11/131172>\
**Category:** Internals & Design\
**Tags:** documenter\
**Created:** [July 29, 2025, 3:12pm UTC](https://discourse.julialang.org/t/cannot-convert-docstr-in-julia-1-11/131172 "2025-07-29T15:12:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirby\_Zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirby_zhang/32/36204_2.png) [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Post date:** [July 29, 2025, 3:12pm UTC](https://discourse.julialang.org/t/cannot-convert-docstr-in-julia-1-11/131172/1 "2025-07-29T15:12:33Z")

</div>

This only happens in Julia 1.11 and only before REPL is loaded:

```julia-auto
method comments require __init__ : Test Failed at K:\DevDocuments\Raven_Inherit\test\PkgTest1\test\runtests.jl:45
  Expression: strip(string(#= K:\DevDocuments\Raven_Inherit\test\PkgTest1\test\runtests.jl:45 =# @doc(NoSubTypesOK))) == "base types can be documented"
   Evaluated: "Base.Docs.DocStr(svec(\"base types can be documented\"), nothing, Dict{Symbol, Any}(:typesig => Union{}, :module => PkgTest1, :linenumber => 7, :binding => PkgTest1.NoSubTypesOK, :path => \"K:\\\\DevDocuments\\\\Raven_Inherit\\\\test\\\\PkgTest1\\\\src\\\\PkgTest1.jl\"))" == "base types can be documented"

Stacktrace:
 [1] macro expansion
   @ K:\.julia\juliaup\julia-1.11.6+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:680 [inlined]
 [2] macro expansion
   @ K:\DevDocuments\Raven_Inherit\test\PkgTest1\test\runtests.jl:45 [inlined]
 [3] macro expansion
   @ K:\.julia\juliaup\julia-1.11.6+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:1709 [inlined]
 [4] top-level scope
   @ K:\DevDocuments\Raven_Inherit\test\PkgTest1\test\runtests.jl:45

```

From the REPL `@doc some_func` returns a `Markdown.MD` in both 1.10 and 1.11, which can be converted via `string()`. But in 1.11, before the REPL is loaded, it’s evaluating to a `Base.Docs.DocStr`, where the `string()` implementation looks more like `repr()`. After the REPL loads, everything is normal again. I wonder if there is a package that needs to be loaded for `string()` to work before the REPL?

The work around for this is:

```julia
if Int(VERSION.minor) >= 11
	using REPL
end

```

---

<div class="post-metadata">

**Author:** ![thofma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thofma/32/1691_2.png) [@thofma](https://discourse.julialang.org/u/thofma)\
**Post date:** [July 29, 2025, 9:29pm UTC](https://discourse.julialang.org/t/cannot-convert-docstr-in-julia-1-11/131172/2 "2025-07-29T21:29:03Z")

</div>

For reference, I think this is the following issue [Type of `@doc x` changes when REPL is loaded · Issue #54664 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/54664). (Does not solve your problem though.)
