      @root = options.root
      @sidenotes = options.sidenotes
 
-    getBreakCost: (node, parent = false) ->
+    getBreakCost: (node) ->
+     if @breakCostMap[node.id]?
+      return @breakCostMap[node.id]
+
      if node.parent()?
       cost = @getBreakCost node.parent(), true
      else

      cost = 0

     if BREAK_COST[node.type]?
      return cost + BREAK_COST[node.type]

     if node.type is 'section'
      if not parent
       switch node.level
        when 1
         cost -= 1500
        when 2
         cost -= 1000
        when 3
         cost -= 100

       return cost
      return cost + 100 * (node.level - 2)


     throw new Error 'Unknown type'


    getOffsetTop: (elem, parent) ->


   INF = 1e10

   PAGE_COST = 100
   BREAK_COST =
    codeBlock: 1000
    special: 1000
