Closed anderskaplan closed 10 months ago
@anderskaplan, thank you, I will try to look at this for the next release.
Finally, I have found time for mistletoe once again. :)
@anderskaplan, I must say "good job" 👍 . Basically, I like it, including the clever way of the new unit test.
Probably just 3 more things be resolved:
line_number
parameter as the last AND optional (with default value of None
) to the constructors of TableRow
etc. (even Table
?)? This way, we could achieve backwards compatibility for those users who might create (some) tokens without actually parsing a markdown text. Yes, there probably won't be many, but what if there are some out there? :)Open question: should the
line_number
be a added torepr_attributes
, so that it gets included in the output fromASTRenderer
?
Not sure here, but probably yes, it could? :)
Hey @pbodnar, just checking in to say hi. The last weeks have been quite busy with other things but I'll get back to this as soon as I can.
I have updated the documentation, made the line_number parameter optional, and run the benchmark as requested in the review.
The benchmark results have a fairly large variance (5 %CV) from run to run on my machine. But I'm fairly confident that the performance penalty of the line numbers is negligible, because if I compare the mean benchmark with and without line numbers from five runs of each type, then the relative difference is about 0.1%. I.e., far less than the run-to-run variance.
I also added the line_number
attribute to repr_attributes
, so that the line numbers are included in the output from the ASTRenderer.
This is a partial solution for #144 which records line numbers on all block tokens. The span tokens are still left unlabeled, but at least it's a starting point, and I think the functionality added here is useful by itself.
Open question: should the
line_number
be a added torepr_attributes
, so that it gets included in the output fromASTRenderer
?