 // MARK: -
 class CodeChunk: InternalRmdChunk, Code {
 	var options: MutableProperty<String>
+	init(parser: SyntaxParser, contents: NSAttributedString, range: NSRange, options: String?) {
+		self.options = MutableProperty<String>(options ?? "")
+		let pchunk = DocumentChunk(chunkType: .code, docType: .rmd, equationType: .none,
+								   range: range, innerRange: range, chunkNumber: 1)
+		super.init(parser: parser, chunk: pchunk)
+		update(text: contents.attributedSubstring(from: range))
+	}
+
 	init(parser: SyntaxParser, contents: String, range: NSRange, options: String?) {
 		self.options = MutableProperty<String>(options ?? "")
 		let pchunk = DocumentChunk(chunkType: .code, docType: .rmd, equationType: .none,

// MARK: -

class InternalInlineEquation: InternalRmdChunk, InlineChunk, Equation {
	init(parser: SyntaxParser, contents: String, range: NSRange) {
		let pchunk = DocumentChunk(chunkType: .equation, docType: .latex, equationType: .inline,
								   range: range, innerRange: range, chunkNumber: 1)
		super.init(parser: parser, chunk: pchunk)
		textStorage.append(NSAttributedString(string: contents.substring(from: range)!))
	}
}

class InternalInlineCodeChunk: InternalRmdChunk, InlineChunk, Code {
	var options: MutableProperty<String>
	init(parser: SyntaxParser, contents: String, range: NSRange, options: String) {
		self.options = MutableProperty<String>(options)
		let pchunk = DocumentChunk(chunkType: .code, docType: .rmd, equationType: .none,
								   range: range, innerRange: range, chunkNumber: 1)
		super.init(parser: parser, chunk: pchunk)
		textStorage.append(NSAttributedString(string: contents.substring(from: range)!))
	}
}



// MARK: -
class EquationChunk: InternalRmdChunk, Equation {
	init(parser: SyntaxParser, contents: NSAttributedString, range: NSRange, innerRange: NSRange) {
		let pchunk = DocumentChunk(chunkType: .equation, docType: .latex, equationType: .display,
								   range: range, innerRange: innerRange, chunkNumber: 1)
		super.init(parser: parser, chunk: pchunk)
		// FIXME: notebook was blowing up with attributed equations
//		let eqstr = contents.attributedSubstring(from: range)
		let eqstr = NSAttributedString(string: contents.string.substring(from: innerRange)!)
		update(text: eqstr)
	}

	init(parser: SyntaxParser, contents: String, range: NSRange, innerRange: NSRange) {
		let pchunk = DocumentChunk(chunkType: .equation, docType: .latex, equationType: .display,
								   range: range, innerRange: innerRange, chunkNumber: 1)
