According to John Gruber's spec and the Stack Overflow parser, the underlining of H1 / H2 using equal signs / dashes requires 1+ instances (not 3+), and the line must not contain anything else.
Create IsFenced helper function. For fenced code blocks, skip HeadingDepth() checks. Detect unlabelled fenced code blocks. Profile markdown-folding on a 1500 line .md file Only run IsFenced test for lines starting with # This produces a big performance boost. Testing with a 1500 line .md file, it went from 5 seconds to 1 second. Still room for improvement. Add README for `test/profiling` directory. Use syntax highlighter to test for fenced code blocks. This produces a big performance boost. Testing with a 1500 line .md file, it went from 1.2 seconds to 0.2 seconds. Provide IsFenced fallback for when syntax is off. Allow fenced languages with syntax highlighting. The g:markdown_fenced_languages setting allows you to enable syntax highlighting of designated languages inside of a fenced code block. Ignore === headings inside fenced code blocks.