Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent interferes with code chunk #41

Closed
kescobo opened this issue Oct 30, 2018 · 2 comments
Closed

Indent interferes with code chunk #41

kescobo opened this issue Oct 30, 2018 · 2 comments

Comments

@kescobo
Copy link
Contributor

kescobo commented Oct 30, 2018

It looks like an indent at the end of a code chunk interferes with the splitting of cells in the resulting notebook. MWE:

In "test.jl":

# Some text

a1 = [1 10 2 20; 3 30 0 0]
#- this works to split
a2 = [1 10 2 20;
    3 30 0 0]
#- this doesn't
a2 = [1 10 2 20;
    3 30 0 0]
a2
#- This does
println("What?")
julia> Literate.notebook("test.jl", "./")
[ Info: generating notebook from `~/computation/julia_playground/intro_julia/test.jl`
[ Info: not running on Travis, skipping links will not be correct.
[ Info: executing notebook `test.ipynb`
[ Info: writing result to `~/computation/julia_playground/intro_julia/test.ipynb`

image

@fredrikekre
Copy link
Owner

Hmm.. This kinda clashes with an undocumented feature; that we can continue code after a section of markdown, see e.g. http://kristofferc.github.io/JuAFEM.jl/latest/examples/generated/heat_equation/#Assembling-the-linear-system-1. I naively implemented this as "a code line that starts with whitespace is not a finished code block" which is what happens here. Maybe an explicit #- like here should not be allowed to be overridden.

@kescobo
Copy link
Contributor Author

kescobo commented Oct 31, 2018

Maybe an explicit #- like here should not be allowed to be overridden.

This makes a lot of sense to me as a heuristic. If someone uses this to manually split a code chunk, there's a good chance that there's a reason for it.

That said, the ability to continue code after a chunk seems like a niche but very cool use case. If it's easier - perhaps disable it by default and allow an option to get that behavior where needed (with the understanding that it will break cases like this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants