Skip to content

Conversation

@chriskirknielsen
Copy link
Contributor

Allows to pull in contextual information for the syntax highlighting, and pass it to a defined function to get a dynamic output.

Allows to pull in laguange dynamically

if (typeof value !== "string" && typeof value !== "number")
throw new Error(
`Attribute "${key}" must have a value of type string or number not "${typeof value}".`

Choose a reason for hiding this comment

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

I like the idea of adding support for callbacks with context. I think we should update the wording of the error message to reflect the allowance of callbacks by saying "…must have, or evaluate to, a value of…"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense! Updating to the following:

`Attribute "${key}" must have, or evaluate to, a value of type string or number, not "${typeof value}".`

@zachleat zachleat merged commit a8ebb01 into 11ty:master Jun 28, 2022
@zachleat
Copy link
Member

We are absolutely going for it here—appreciate this one, I love it!

This will be packaged with 4.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

3 participants