https://github.com/JuliaLang/julia
Revision d453af81c8c70f06b2c8b70cef566ffdc5705958 authored by Steve Kelly on 07 February 2024, 04:53:09 UTC, committed by GitHub on 07 February 2024, 04:53:09 UTC
This issue was introduced in #52442.
The markdown parser had issues with the triple-quotes.
Usually you can use quadruple-quotes to fix this, but
this does not appear to be supported, so we escape
each with backslash.

Here is the corrected docstring rendered:

```julia-repl
help?> @__DIR__
  @__DIR__ -> String

  Macro to obtain the absolute path of the current directory as a string.

  If in a script, returns the directory of the script containing the @__DIR__ macrocall. If run from a REPL or if
  evaluated by julia -e <expr>, returns the current working directory.

  Example
  ≡≡≡≡≡≡≡

  The example illustrates the difference in the behaviors of @__DIR__ and pwd(), by creating a simple script in a
  different directory than the current working one and executing both commands:

  julia> cd("/home/JuliaUser") # working directory

  julia> # create script at /home/JuliaUser/Projects
         open("/home/JuliaUser/Projects/test.jl","w") do io
             print(io, """
                 println("@__DIR__ = ", @__DIR__)
                 println("pwd() = ", pwd())
             """)
         end

  julia> # outputs script directory and current working directory
         include("/home/JuliaUser/Projects/test.jl")
  @__DIR__ = /home/JuliaUser/Projects
  pwd() = /home/JuliaUser
```
1 parent 41bbfb4
History
Tip revision: d453af81c8c70f06b2c8b70cef566ffdc5705958 authored by Steve Kelly on 07 February 2024, 04:53:09 UTC
Fix escaping of docstring in `@__DIR__` (#53225)
Tip revision: d453af8
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 571 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 372.8 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.9 KB
Makefile -rw-r--r-- 30.2 KB
NEWS.md -rw-r--r-- 11.5 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.9 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 37.8 KB
pkgimage.mk -rw-r--r-- 5.9 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top