mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-24 14:58:35 +08:00
Do not export setup cell output (#2184)
This commit is contained in:
parent
070d6a5c0f
commit
867f091557
2 changed files with 30 additions and 1 deletions
|
@ -62,7 +62,7 @@ defmodule Livebook.LiveMarkdown.Export do
|
|||
end)
|
||||
|
||||
name = ["# ", notebook.name]
|
||||
setup_cell = render_setup_cell(setup_cell, ctx)
|
||||
setup_cell = render_setup_cell(setup_cell, %{ctx | include_outputs?: false})
|
||||
sections = Enum.map(notebook.sections, &render_section(&1, notebook, ctx))
|
||||
|
||||
metadata = notebook_metadata(notebook)
|
||||
|
|
|
@ -642,6 +642,35 @@ defmodule Livebook.LiveMarkdown.ExportTest do
|
|||
assert expected_document == document
|
||||
end
|
||||
|
||||
test "does not include setup cell output" do
|
||||
notebook = %{Notebook.new() | name: "My Notebook"}
|
||||
|
||||
notebook =
|
||||
update_in(notebook.setup_section.cells, fn [setup_cell] ->
|
||||
[
|
||||
%{
|
||||
setup_cell
|
||||
| source: """
|
||||
IO.puts("hey")\
|
||||
""",
|
||||
outputs: [{0, terminal_text("hey", true)}]
|
||||
}
|
||||
]
|
||||
end)
|
||||
|
||||
expected_document = """
|
||||
# My Notebook
|
||||
|
||||
```elixir
|
||||
IO.puts("hey")
|
||||
```
|
||||
"""
|
||||
|
||||
{document, []} = Export.notebook_to_livemd(notebook, include_outputs: true)
|
||||
|
||||
assert expected_document == document
|
||||
end
|
||||
|
||||
test "removes ANSI escape codes from the output text" do
|
||||
notebook = %{
|
||||
Notebook.new()
|
||||
|
|
Loading…
Reference in a new issue