Giter Club home page Giter Club logo

Comments (9)

ChrisRackauckas avatar ChrisRackauckas commented on May 16, 2024 1

I wrote out an example to see what the tests would look like in this syntax. I think that the text from block comments should also be allowed because it got kind of cluttered with #s.

from documenter.jl.

fredrikekre avatar fredrikekre commented on May 16, 2024 1

I created https://github.com/fredrikekre/Literate.jl to solve this exact problem. Works quite well and generates markdown and a notebook. The source file is runnable julia so they can be included in the tests.

from documenter.jl.

MichaelHatherly avatar MichaelHatherly commented on May 16, 2024

Perhaps this would be nice to make more accessible than it is currently, but it can be done using {eval} code blocks as follows:

In Package/test/example.jl:

A = rand(3, 3)
b = [1, 2, 3]

A \ b

and in Package/docs/src/index.md:

```
{eval}
Markdown.Code("julia", readall(joinpath("..", "..", "test", "example.jl")))
```

Any suggestions for syntax to annotate the file contents? I'd be inclined to just add them as comments in the test file itself since splitting content and discussion across multiple locations would probably result in things getting out of sync quickly.

from documenter.jl.

ChrisRackauckas avatar ChrisRackauckas commented on May 16, 2024

I agree that it's best if the annotations were in the code (then the code would read as a nice tutorial as well.

We may want this annotation to match up with JunoLab/atom-julia-client#63. Maybe @pfitzseb would like to chime in. They are looking to make "executable code blocks" where you can divy up a file and have it just execute parts at a time. I think that this would match quite well to this, since in a tutorial you probably want a block of text, then a block of code, then repeat. So maybe just make a block that is only a string? ##"""" """"##, matching the syntax they use?

It seems like they want ## since it matches with Markdown. I'd say that after making documentation it would be best if the blocks would also work with making ### since it would be too many h2 headers.

from documenter.jl.

MichaelHatherly avatar MichaelHatherly commented on May 16, 2024

Yes, would be good to reuse syntax from elsewhere for this rather than reinventing more things.

from documenter.jl.

pfitzseb avatar pfitzseb commented on May 16, 2024

Not that I'm totally sure if that's what you're looking for, but I'd imagine something like

### Starting a new cell
# Let's foo the bar:
foobar = foo(bar)
# And indeed, it's foo'ed:
@test foobar == 42

### Next cell
...

to work nicely. It should be quite easy to transform this to


Starting a new cell

Let's foo the bar

foobar = foo(bar)

And indeed, it's foo'ed:

@test foobar == 42

Next cell

...


by just having a mapping from literal code to code blocks and then stripping the first # from the comments.

from documenter.jl.

MichaelHatherly avatar MichaelHatherly commented on May 16, 2024

Thanks for the description @pfitzseb, that looks good to me.

from documenter.jl.

MichaelHatherly avatar MichaelHatherly commented on May 16, 2024

text from block comments should also be allowed

Fine with me.

from documenter.jl.

mortenpi avatar mortenpi commented on May 16, 2024

I am wondering whether there is some API Documenter could provide to make it a bit more natural to include dynamically generated pages. However, this feature exists as package now, so I think we can close this issue, and new issues can be opened if there are more specific requests.

from documenter.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.