Conversation
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
| } | ||
|
|
||
| func (l *chain) TransformDestination(ctx mdformatter.SourceContext, destination []byte) (_ []byte, err error) { | ||
| func (l *chain) TransformDestination(ctx mdformatter.SourceContext, destination []byte, lines string) (_ []byte, err error) { |
There was a problem hiding this comment.
lines of what? do you mean lineNumber?
I find it very confusing we need to pass lines through transformers args 🤔
Why not adding it to SourceContext?
There was a problem hiding this comment.
Didn't think of that. Will try to implement! 🙂
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
| if token.Attr[i].Key != "src" { | ||
| continue | ||
| } | ||
| t.sourceCtx.LineNumbers = getLinkLines(source, []byte(token.Attr[i].Val), t.frontMatterLen) |
There was a problem hiding this comment.
I am pretty sure we can get this directly from node (...) offset 🤔
Traversing huge file might get us quite latency problems... can we try that? 🤗
There was a problem hiding this comment.
Sure! Will try to implement this! 🙂
There was a problem hiding this comment.
I can't seem to find any offset method/field which could give line numbers for a particular node. I could only find this method in text package but functionality seems to be different...
There was a problem hiding this comment.
It actually shows the offset in source 🤔 usually ;p
bwplotka
left a comment
There was a problem hiding this comment.
Not fan of this reparsing source....
But should work for now. Let's optimize if needed later 👍🏽
This PR adds line numbers to errors in the following way,
Fixes #36.