 	}
 	
 	@IBOutlet weak var outputView: WKWebView?
+	
+	// MARK: - standard overrides
 	
 	override func viewDidLoad() {
 		super.viewDidLoad()

			fatalError("failed to load initial preview content: \(error)")
		}
	}

	/// called when the context property has been set
	private func contextChanged() {
		lastContents = nil
		parsedDocument = nil
		curDocDisposable?.dispose()
		curDocDisposable = nil
		contentsDisposable?.dispose()
		contentsDisposable = nil
		curDocDisposable = editorContext?.currentDocument.signal.observeValues({ [weak self] newDoc in
			self?.documentChanged()
		})
		if !resourcesExtracted {
			ensureResourcesLoaded()
		}
		documentChanged()
	}
	
	/// parses the parsed document and loads it via javascript
	private func updatePreview(updatedContents: String? = nil) {
		guard !parseInProgress else { return }
		guard didLoadView else { return }
		var updateParse = true
		var clearLastContents = false
		defer { if clearLastContents { self.lastContents = nil} }
		if parsedDocument == nil {
			// need to do initial load. might be no contents if called before document loaded
			guard let contents = context.value?.currentDocument.value?.currentContents

				return
			}
		}
		
		// handle empty content
		guard let curDoc = parsedDocument else {
			load(html: emptyContents)
			return
