Browse Source

Remove @extref from non-Documenter output

Recent versions of Documenter use `@extref` link to documentation of
external packages.

Remove these in the same way and under the same conditions as `@ref` and
`@id` tags.
pull/245/head
Nathan Musoke 2 years ago
parent
commit
c193623105
  1. 9
      CHANGELOG.md
  2. 8
      docs/src/documenter.md
  3. 4
      src/Literate.jl

9
CHANGELOG.md

@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Literate will now remove Documenter-style `@extref` links under the same
circumstances as `@ref` and `@id`. Recent versions of Documenter use
`@extref` to links to the documentation of external packages. See
https://github.com/JuliaDocs/Documenter.jl/issues/2366 for details of
the Documenter implementation.
## [v2.17.0] - 2024-04-14
### Added
- Literate can now output [Quarto](https://quarto.org/) notebooks (markdown documents with

8
docs/src/documenter.md

@ -31,8 +31,8 @@ if we set `documenter = true`: @@ -31,8 +31,8 @@ if we set `documenter = true`:
````
### [`Literate.notebook`](@ref):
- Documenter style `@ref`s and `@id` will be removed. This means that you can use
`@ref` and `@id` in the source file without them leaking to the notebook.
- Documenter style `@ref`s, `@extref`s and `@id` will be removed. This means that you can use
`@ref`, `@extref` and `@id` in the source file without them leaking to the notebook.
- Documenter style markdown math
````
```math
@ -57,5 +57,5 @@ if we set `documenter = true`: @@ -57,5 +57,5 @@ if we set `documenter = true`:
```
### [`Literate.script`](@ref):
- Documenter style `@ref`s and `@id` will be removed. This means that you can use
`@ref` and `@id` in the source file without them leaking to the script.
- Documenter style `@ref`s, `@extref`s and `@id` will be removed. This means that you can use
`@ref`, `@extref` and `@id` in the source file without them leaking to the script.

4
src/Literate.jl

@ -217,9 +217,11 @@ function replace_default(content, sym; @@ -217,9 +217,11 @@ function replace_default(content, sym;
# Run some Documenter specific things
if !isdocumenter(config)
## - remove documenter style `@ref`s and `@id`s
## - remove documenter style `@ref`s, `@extref`s and `@id`s
push!(repls, r"\[([^]]+?)\]\(@ref\)"s => s"\1") # [foo](@ref) => foo
push!(repls, r"\[([^]]+?)\]\(@ref .*?\)"s => s"\1") # [foo](@ref bar) => foo
push!(repls, r"\[([^]]+?)\]\(@extref\)"s => s"\1") # [foo](@extref) => foo
push!(repls, r"\[([^]]+?)\]\(@extref .*?\)"s => s"\1") # [foo](@extref bar) => foo
push!(repls, r"\[([^]]+?)\]\(@id .*?\)"s => s"\1") # [foo](@id bar) => foo
end

Loading…
Cancel
Save