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

slightly more precise types for format nodes #97

Merged
merged 3 commits into from
Feb 15, 2023
Merged

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Jan 30, 2023

see #96 (comment)

Note that this is a breaking change.

@@ -137,25 +137,25 @@ export type TextNode = {

export type StarNode = {
name: 'star';
contents: FragmentNode[];
contents: (TextNode | CommentNode | TagNode)[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a breaking change anyway, is there sufficient reason to continue supporting comments and tags inside *, `, and ~ formatting wrappers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is breaking in the sense of requiring integration work in ecmarkup, but not in the sense of requiring any specifications to change. Whereas prohibiting tags inside of * would actually be a breaking change for at least Temporal. Since I've already written the code necessary to support the more complicated types there's not that much to be gained by restricting these and forcing Temporal to adapt, I think.

Copy link
Contributor

@gibson042 gibson042 Jan 30, 2023

Choose a reason for hiding this comment

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

Fair enough. I've opened tc39/proposal-temporal#2494 against Temporal regardless, and don't see any offending text in either ecma262 or ecma402. It might also make a good linter check, but that's obviously not necessary.

And if the functionality is worth keeping, it should probably be documented at https://github.com/tc39/ecmarkdown#inline-formatting .

Copy link
Contributor Author

@bakkot bakkot Jan 31, 2023

Choose a reason for hiding this comment

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

it should probably be documented at

It is, I think? The constraint on _ is "cannot contain whitespace or other formatting characters", whereas the constraint on * is "cannot contain asterisks", for example.

Edit: wait, no, that's entirely the wrong statement.

@bakkot bakkot merged commit bcd953b into main Feb 15, 2023
@bakkot bakkot deleted the more-precise-node-types branch February 15, 2023 06:03
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.

None yet

2 participants