Module: IpynbDiff

Defined in:
lib/diff.rb,
lib/version.rb,
lib/ipynbdiff.rb,
lib/transformer.rb,
lib/ipynb_symbol_map.rb,
lib/output_transformer.rb,
lib/transformed_notebook.rb,
lib/symbolized_markdown_helper.rb

Overview

Human Readable Jupyter Diffs

Defined Under Namespace

Modules: SymbolizedMarkdownHelper Classes: Diff, InvalidNotebookError, InvalidTokenError, IpynbSymbolMap, JsonSymbol, OutputTransformer, TransformedNotebook, Transformer

Constant Summary collapse

VERSION =
"0.4.7"

Class Method Summary collapse

Class Method Details

.diff(from, to, raise_if_invalid_nb: false, include_frontmatter: false, hide_images: false, diffy_opts: {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/ipynbdiff.rb', line 8

def self.diff(from, to, raise_if_invalid_nb: false, include_frontmatter: false, hide_images: false, diffy_opts: {})
  transformer = Transformer.new(include_frontmatter: include_frontmatter, hide_images: hide_images)

  Diff.new(transformer.transform(from), transformer.transform(to), diffy_opts)
rescue InvalidNotebookError
  raise if raise_if_invalid_nb
end

.transform(notebook, raise_errors: false, include_frontmatter: true, hide_images: false) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/ipynbdiff.rb', line 16

def self.transform(notebook, raise_errors: false, include_frontmatter: true, hide_images: false)
  return unless notebook

  Transformer.new(include_frontmatter: include_frontmatter, hide_images: hide_images).transform(notebook).as_text
rescue InvalidNotebookError
  raise if raise_errors
end