 		setBaseTokenizer(tok)
 		// Default (rmd) chunk begin & end symbols:
 		//>>>TODO: make blocks only work at beginning, skip \n#...
-		var codeBlockPoss = "```{r", codeBlockBegin = "}", codeBlockEnd = "```"
+		var codeBlockPoss = "```{r", codeBlockBegin = "}", codeBlockEnd = "```\n"
 		let codeInlineBegin	= "`r", codeInlineEnd = "`"
-		let eqBlock = "$$", eqInline = "$"
+		let eqBlock = "$$\n", eqInline = "$"
 		// For R-Markdown,
 		if docType == .rmd {
 			// add markdown comment tokens:

		tok.symbolState.add("<math")	// eqBlock mathML possible
		tok.symbolState.add(">")		// eqBlock mathML definite
		tok.symbolState.add("</math>")	// eqBlock mathML end
		let frontMatterSymbol = "---"
		tok.symbolState.add(frontMatterSymbol)
		// Init Range parameters:
		var begin:Int = 0, end:Int = 0

			else if state == .frontMatter  {
				if token.stringValue == frontMatterSymbol {
					token = tok.nextToken()!
					end = Int(token.offset) - frontMatterSymbol.count
					if end > inRange.length { end = inRange.length }
					if end-begin > 0 {
						let range = NSMakeRange(begin, end-begin)
						frontMatter = textStorage.string.substring(from: range)!
						begin = end + frontMatterSymbol.count
					}
					beyondFrontMatter = true
				}
