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

										   equationType: currType.2, range: range,
										   innerRange:range, chunkNumber: chunkIndex)
						chunks.append(ch); chunkIndex += 1
						print("num=\(ch.chunkNumber)\t range=\(ch.parsedRange)\t inner=\(ch.innerRange)\t type=\(ch.chunkType),\(ch.equationType)")
						begin = end
					}
					currType = newType

			else if token.stringValue == "---" {
				state = .frontMatter
				token = tok.nextToken()!
				begin = Int(token.offset)
			}
			else {
				beyondFrontMatter = true
			}
		}
		// print("\(frontMatter)")
		// Reference:
		//		public enum ChunkType {
		//			case docs, code, equation
