 		}
 		var html =  ""
 		for (chunkNumber, chunk) in curDoc.chunks.enumerated() {
-			html += "<section index=\"\(chunkNumber)\">\n"
+			let descriptor = chunk.isInline ? "inline" : "section"
+			html += "<\(descriptor) index=\"\(chunkNumber)\">\n"
 			html += htmlFor(chunk: chunk, index: chunkNumber)
-			html += "\n</section>\n"
+			html += "\n</\(descriptor)>\n"
 		}
 		docHtmlLoaded = true
 		load(html: "\(headerContents)\n\(html)\n\(footerContents)")
+		outputView?.evaluateJavaScript("MathJax.typeset()", completionHandler: nil)
 	}
 	
 	private func htmlFor(chunk: RmdDocumentChunk, index: Int) -> String {

		guard let doc = parsedDocument else { fatalError("textFor called w/o a document") }
		let inlineText = doc.string(for: inlineChunk, type: .inner)
		var icText = inlineText
		switch RootChunkType(inlineChunk.chunkType) {
		case .code:
			icText = doc.string(for: inlineChunk, type: .outer)
		case .equation:
			icText = "\\(\(inlineText)\\)"
		case .markdown:
			preconditionFailure("inline chunk can't be markdown")
		}
		return icText
	}

			Log.info("udpating just chunks \(changedChunkIndexes)")
			for chunkNumber in changedChunkIndexes {
				let chunk = curDoc.chunks[chunkNumber]
				var html = htmlFor(chunk: chunk, index: chunkNumber)
				html = escapeForJavascript(html)
				
				let command = "$(\"section[index='\(chunkNumber)']\").html('\(html)'); MathJax.typeset()"
//				let command = "document.querySelector('section[index=\(chunkNumber)]').html('\(html)'); MathJax.typeset(); debugger;"
				outputView?.evaluateJavaScript(command, completionHandler: nil)
			}
		} else { // no changes, so just refresh everything
