Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide more details on error when Markdown code block is misformatted #5743

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

parlough
Copy link
Member

@MaryaBelanger I believe #5732 is caused by a code block without a language specified in your local branch in the /src/content/language/macros.md file. This PR makes that more obvious by providing an error explaining that.

I'll follow-up with a better error message, but wanted to make sure this actually was the issue you're facing. I'm also open to changing the requirement of a language if that's helpful or important to you. Thanks!

@dart-github-bot
Copy link
Collaborator

Visit the preview URL for this PR (updated for commit a46dc05):

https://dart-dev--pr5743-fix-5732-wixk2mlr.web.app

Copy link
Contributor

@MaryaBelanger MaryaBelanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that was it! I think the error message reads perfectly, thanks for figuring it out.

How did you figure that out by the way? Reading the error log didn't seem to point to anything concrete

@parlough parlough merged commit 926f56c into main Apr 24, 2024
10 checks passed
@parlough
Copy link
Member Author

@MaryaBelanger I determined it roughly by:

I looked at the lines at the beginning of the stack trace:

[11ty] Original error stack trace: TypeError: Cannot read properties of null (reading 'length')
[11ty]     at markdown.renderer.rules.fence (file:///Users/mbelanger/Projects/dart.dev/dart-3/src/_11ty/plugins/highlight.js:49:37)

This line tried to use which was the result of token.info.match(/(\S+)\s?(.*?)$/m); (stored in splitTokenInfo) when parsing a Markdown code block(fence). So splitTokenInfo must have been null, meaning that regex didn't find any matches when parsing the opening fence line.

@parlough parlough deleted the fix/5732 branch April 24, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants