<aside> 👉
Links (Block base class)
Notion Ruby Mapping Public API Reference
</aside>
String, an EquationObject, or nil. nil is normalized to an empty expression.self.new creates an EquationBlock. When an EquationObject is supplied, the block uses that object internally. The equation block payload contains its expression value.
block = EquationBlock.new "x = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}"
block.block_json
# => {"type"=>"equation", "object"=>"block", "equation"=>{"expression"=>"x = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}"}}
When the argument is omitted or nil, expression is an empty string.
EquationBlock.new.expression
# => ""
expression returns the LaTeX expression string of the EquationBlock.
block = EquationBlock.new "x = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}"
block.expression
# => "x = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}"
String, or nil. nil is normalized to an empty string.expression= replaces the equation expression and marks expression for the next block update.
block = EquationBlock.new "x = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}"
block.expression = "X(z) = \\sum_{n=-\\infty}^{\\infty}x[n]z^{-n}"
block.update_block_json
# => {"equation"=>{"expression"=>"X(z) = \\sum_{n=-\\infty}^{\\infty}x[n]z^{-n}"}}
Ruby interprets backslashes inside double-quoted strings. Escape each backslash as \\, or use an appropriate string literal for the LaTeX expression.
$\fbox{implemented in Block}$
true, returns a verification script without sending the update request.save sends the pending equation block changes to the Notion API. Without dry_run, it returns the updated EquationBlock created from the API response.
block = Block.find "899e342cec84415f9ff86225704cbb75"
block.expression = "E = mc^2"
block.save
# => #<NotionRubyMapping::EquationBlock:...>
Use dry_run: true to inspect the update request without sending it.
block.expression = "E = mc^2"
block.save dry_run: true
# => "#!/bin/sh\n# curl -X PATCH ..."