-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from PumasAI/mh/inline-code
Fix #15, inline code
- Loading branch information
Showing
3 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
include("../utilities/prelude.jl") | ||
|
||
@testset "Inline code" begin | ||
mktempdir() do dir | ||
qmd = joinpath(dir, "inline_code.qmd") | ||
write( | ||
qmd, | ||
""" | ||
--- | ||
title: "Inline code" | ||
--- | ||
```{julia} | ||
a = 1 | ||
``` | ||
Some variables `{julia} a + 1`. | ||
```{julia} | ||
struct Custom | ||
value | ||
end | ||
Base.show(io::IO, ::MIME"text/markdown", c::Custom) = print(io, "*\$(c.value)*") | ||
``` | ||
Some custom markdown MIME type output `{julia} Custom("markdown")`. | ||
```{julia} | ||
b = Text("*placeholder*") | ||
``` | ||
Some `Text` objects *`{julia} b`*. Escaped markdown syntax. | ||
```{julia} | ||
c = "*placeholder*" | ||
``` | ||
Some plain `String`s `{julia} c`. Escaped markdown syntax. | ||
> # A more complex expression `{julia} round(Int, 1.5)`. | ||
""", | ||
) | ||
|
||
server = Server() | ||
json = run!(server, qmd; showprogress = false) | ||
|
||
cells = json.cells | ||
|
||
cell = cells[3] | ||
@test any(contains("Some variables 2."), cell.source) | ||
|
||
cell = cells[5] | ||
@test any( | ||
contains("Some custom markdown MIME type output *markdown*."), | ||
cell.source, | ||
) | ||
|
||
cell = cells[7] | ||
@test any(contains("Some `Text` objects *\\*placeholder\\**."), cell.source) | ||
|
||
cell = cells[9] | ||
@test any(contains("Some plain `String`s \"\\*placeholder\\*\"."), cell.source) | ||
@test any(contains("A more complex expression 2."), cell.source) | ||
end | ||
end |