Skip to content

Highlight julia-repl code in Markdown specially#54423

Merged
fredrikekre merged 1 commit intoJuliaLang:masterfrom
tecosaur:markdown-handle-julia-repl
May 10, 2024
Merged

Highlight julia-repl code in Markdown specially#54423
fredrikekre merged 1 commit intoJuliaLang:masterfrom
tecosaur:markdown-handle-julia-repl

Conversation

@tecosaur
Copy link
Copy Markdown
Member

@tecosaur tecosaur commented May 9, 2024

Fixes #54399 by re-introducing the code seperated out from the styled Markdown PR at Jameson's request (#51928 (comment)).

The code itself is modelled after equivalent code in OhMyREPL.

Sample:

image

Bonus:

The new markdown_julia_prompt face allows people to make the "prompt" shown in Markdown code visually distinct, to avoid confusing it with the REPL prompt at a glance. By way of example, I make it italic by augmenting my faces.toml with

[markdown]
julia_prompt = { italic = true }

image

Copy the approach taken by OhMyREPL.jl, and make the highlighting of
julia-repl and jldoctest more closely mirror the REPL experience.

This code was originally part of 1614e11, but was
separated out at Jameson's request so it could be discussed seperately.
@tecosaur tecosaur added display and printing Aesthetics and correctness of printed representations of objects. markdown labels May 9, 2024
@fredrikekre fredrikekre merged commit 6582eaa into JuliaLang:master May 10, 2024
@BioTurboNick
Copy link
Copy Markdown
Contributor

It would be nice for users if the help prompt could always use the less-confusing rendering of the julia prompt when docstrings are printed. Would that be possible?

@tecosaur
Copy link
Copy Markdown
Member Author

Sounds good to me, I think the question then is just what the default should be.

lazarusA pushed a commit to lazarusA/julia that referenced this pull request Jul 12, 2024
Fixes JuliaLang#54399 by re-introducing the code seperated out from the styled
Markdown PR at Jameson's request
(JuliaLang#51928 (comment)).

The code itself is modelled after [equivalent code in
OhMyREPL](https://github.com/KristofferC/OhMyREPL.jl/blob/b0071f5ee785a81ca1e69a561586ff270b4dc2bb/src/MarkdownHighlighter.jl#L15-L31).

The new `markdown_julia_prompt` face allows people to make the "prompt"
shown in Markdown code visually distinct, to [avoid confusing it with
the REPL prompt at a
glance](KristofferC/OhMyREPL.jl#100). By way
of example, I make it italic by augmenting my `faces.toml` with

```toml
[markdown]
julia_prompt = { italic = true }
```
@tecosaur tecosaur deleted the markdown-handle-julia-repl branch August 11, 2024 04:46
KristofferC added a commit that referenced this pull request Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

display and printing Aesthetics and correctness of printed representations of objects. markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REPL stdout output should not be highlighted in code examples

3 participants