Comments (7)
So, I suggest to have the functionality of
{example}
with the possibility of inserting the"julia> "
prompt after parsing.
Yes, sounds like a good addition.
The implicit meaning of the {...}
syntax is that it denotes generated content, whereas doctest blocks only compare results without creating anything new. Following that approach would indeed lead to implementing this with a {example-repl}
, or perhaps just {repl}
, rather than as a .language
name.
(Switching over to #5 is possible, but at this point there's already quite a lot of code out there using the current syntax, so I'm not sure whether changing would be all that beneficial.)
Regarding some more specific concerns about a possible {repl}
syntax:
- Would
julia>
be added infront of every toplevel expression, or would it be possible to group several like you can do withalt-return
in the real REPL? - Semi-colons would presumably hide output as usual?
from documenter.jl.
I like the name {repl}
for such a mode.
Ideally, and considering the case of a user guide, the code
{repl}
a = 2
b = 3
c = 4;
a + b
should produce
julia> a = 2
2
julia> b = 3
3
julia> c = 4;
julia> a+b-c
1
That is, unless we use explicitly the semi-colon, the result appears right after the executed line. (This saves typing lots of {example}
or {repl}
blocks, if this is the intended output.) For grouping several lines, mimicking alt-return
, probably {repl-block}
would be the way to go, and the output should correspond only to the last statement, just as the REPL behaves.
from documenter.jl.
Incidentally, part of this issue was actually motivated because, when I used {example}
and @time whatever();
(note the semicolon at the end), the output from whatever();
was not suppressed.
from documenter.jl.
the output from
whatever();
was not suppressed.
You can get the same effect, if I'm understanding correctly, with a nothing # hide
line as in
{example}
f(x) = (sleep(2x); 3x)
@time f(1)
nothing # hide
Not the most elegant, but it should work.
probably
{repl-block}
would be the way to go
Having an additional {...}
just for that would probably not be worth it. Grouping things like that isn't too important for a first implementation though.
from documenter.jl.
Thanks for the provided code; it indeed works nicely (except for the missing julia>
...
You are right, there is no need for another type of grouping.
from documenter.jl.
{repl}
blocks have been added in 7168524.
from documenter.jl.
Thanks!
from documenter.jl.
Related Issues (20)
- Make search_index a JSON file
- Alternative admonition syntax?
- Support for external parsers like CommonMark HOT 2
- Profiling docs build times HOT 3
- Not Matching Versions for Subpackage Version Tags HOT 1
- docstrings in extensions HOT 1
- Add a note to contributor docs about how to format code
- Add `make` command to run prettier
- Deserialization in Julia code blocks can throw an error. HOT 2
- proposal for rendering images when last value from @example blocks HOT 5
- Generated files with Documenter.jl and julia-docdeploy have random characters included in their name, not rendering correctly HOT 4
- Feature request: Cross module links HOT 2
- (Perhaps) Incorrectly interpreting square brackets in docstrings as links HOT 3
- Undesirable `Main.var"Main"` qualification of new modules HOT 2
- html field type not implemented HOT 1
- Can we make search modify the URL HOT 4
- Erroneous Errors with `checkdocs`
- Feature request: ANSI color output in reference documentation HOT 6
- Option to Disable collapse/expand HOT 2
- How to use `@repl` and `@example` in docstring?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from documenter.jl.