-
Notifications
You must be signed in to change notification settings - Fork 66
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
✨ Add csv-table
directive
#1030
Conversation
2e44155
to
a7d138b
Compare
a7d138b
to
14ea13e
Compare
14ea13e
to
419148e
Compare
419148e
to
4b0da69
Compare
@rowanc1 I've held off adding file/URL support for this pass - I don't think it should block this PR. I'll discuss that on Discord! The only outstanding challenge is where to add tests ... I'm somewhat happy to skip tests here, as I think those are more end-to-end features that we might need to do another pass of down the road. That might also be a lazy developer's hat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that a small test would be great to have on the directive or main part of the run function (which we will likely need to export later if we are doing a delayed, async load of the CSV in a transform). The test should at least cover the error state of bad CSV. I can add that when I test/export if I get there first!
})), | ||
); | ||
} | ||
const cells = parseCSV(data.body as string, data.options, ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a try catch and errorFile on this if the csv is malformed!
I've made the change to use select('mystDirectiveOption[name="tags"]', data.node) ?? data.node |
Providing a node with the option reports the correct line number of the option in the error, rather than the directive itself. It falls back to the directive in that case if it can't find the specific option. When we get column numbers and language server support, these will be correctly-placed red-underlines. :) |
Oh yes, I'm following the use-case! What I meant was, I wasn't sure of the AST layout of these raw nodes. But, I think I've found it! I'll revise the change. |
Implements https://docutils.sourceforge.io/docs/ref/rst/directives.html#csv-table-1, addressing need on #189
See #893.