tdast utility to parse csv into tdast (RFC-4180 compliant).
npm install tdast-util-from-csv
With some RFC-4180 compliant CSV content (example below includes escaped double quotes and linebreaks):
"col1","c""o""""l,2,,","co\nl\n\n3\n"row1col1, row1col2 ," row1col3\n,\n""""\nrow2col1",row2col2,row2col3\n
tdast-util-from-csv will parse the CSV content into a tdast
Table node tracking row/column/cell offsets and attaching well-defined
;const options = header: true ;;
RFC-4180 compliant CSV parser to parse CSV to a tdast
Cell nodes conveniently escape any double-quote characters while preserving the original
UnistPosition. This enables conversion of the tdast tree into other syntax trees that can make use of the positional information.
I have little experience writing parsers. Unlike most CSV parsers, this parser does not use regexp and its implementation is specifically written to track and assemble a tdast tree with well-defined
The parser should be well-behaved since it is implemented against the RFC-4180 spec with some testing.
If there are any issues or you want to implement this in a more elegant/efficient way, please let me know through GH issues!