This seems related to previous bugs but was not able to isolate the problem. Installed the latest dev build and still reproduces.
I'm attempting to insert a ToC for the markdown here:
https://bitbucket.org/ParadoxGBB/cinadmin/src/master/README.md
The template of the format is provided by BitBucket.org.
This might be due to the commenting style I have for my code samples (# is a comment in PowerShell), however all of those examples are indented so should have been covered by other fixes.
F1 + "Create Table of Contents"
Command 'Markdown All in One: Create Table of Contents' resulted in an error (Cannot read property '1' of null)
This might be due to the commenting style I have for my code samples (# is a comment in PowerShell), however all of those examples are indented so should have been covered by other fixes.
Thanks for the information. I can reproduce the problem with
## Extensions ##
----------------
When you configure CinAdmin to poll and monitor for media changes ($POLLING_SCRIPTS), ...:
$POLLING_SCRIPTS = @{
# CORE
($SCRIPT_PATH + "\Check-MediaSubscription.ps1") = "04:00:00";
}
These entries can be added or removed to tweak how the tool works for you...
This is a bug when there is a # CORE in a fenced code block indented with a TAB character.
Indented code blocks may be accidentally captured, when the code block is created by TAB (U+0009).
TypeError: Cannot read property '1' of null
at Array.map (<anonymous>)
at buildToc
at generateTocText
at detectTocRanges
The exception is thrown at
https://github.com/yzhang-gh/vscode-markdown/blob/ff79b2e7a69dcbfd04d5c289999c1a09ef784e61/src/toc.ts#L378
When processing
https://bitbucket.org/ParadoxGBB/cinadmin/annotate/477a1f994737cd6eb197f4101c4066bc987c1a8b/README.md#README.md-302
'\t\t# CORE'
Thanks for the help with this. I tried removing that specific offending line (#CORE) and still got the same error. I scanned the code for another example of a comment within a block and didn't find any --- so I suspect there might be another issue lurking in there somewhere.
EDIT: I also tried removing the comment here, still doesn't work:
$ACQUISITION_DOWNLOAD_SUBTITLES = $false #Only supports TTML
There are ~40 occurrences of \t# in your file.
Not sure what I did in this WIP branch (dev/fix/heading-recognition):
https://github.com/yzhang-gh/vscode-markdown/tree/a848db4c32ca00c91a2cf2b426da414ece4d9991
but the problem is accidentally solved there. 馃槀
WARNING: Do not use that branch in production. It is still partial work, and does not pass all tests.
My mistake, I thought the scope of the problem was a hash comment within an indented codeblock ({...}). Thanks for the clarification.
Installed this build and works great! Thanks so much.
Most helpful comment
Conclusion
Indented code blocks may be accidentally captured, when the code block is created by TAB (U+0009).
Stack trace
The exception is thrown at
https://github.com/yzhang-gh/vscode-markdown/blob/ff79b2e7a69dcbfd04d5c289999c1a09ef784e61/src/toc.ts#L378
When processing
https://bitbucket.org/ParadoxGBB/cinadmin/annotate/477a1f994737cd6eb197f4101c4066bc987c1a8b/README.md#README.md-302