You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running into a bit of a confusing problem (at least for me.) Two different kinds of links give different sourcepos values when I believe they should be the same.
Here's some demo code:
use comrak::{
arena_tree::{Node,NodeEdge},
nodes::{NodeValue,Sourcepos},
parse_document,Arena,ExtensionOptions,Options,};fndemo(source:&str) -> Sourcepos{let arena = Arena::new();letmut extension = ExtensionOptions::default();
extension.autolink = true;let root = parse_document(&arena,
source,&Options{
extension,
..Default::default()},);let link = root
.traverse().filter_map(|x| match x {NodeEdge::Start(Node{ data, .. }) => Some(data.borrow().clone()),
_ => None,}).filter(|x| matches!(x.value, NodeValue::Link(_))).next().unwrap();
link.sourcepos}fnmain(){let a = demo("hello <https://example.com/fooo> world");let b = demo("hello [foo](https://example.com) world");assert_eq!(a, b);}
Hmm, I think you're right. It looks like [foo](https://example.com) is generating the correct sourcepos, but <https://example.com/fooo> isn't. They should give the same value, as both links start and end in the same column.
Running into a bit of a confusing problem (at least for me.) Two different kinds of links give different
sourcepos
values when I believe they should be the same.Here's some demo code:
And the output I'm getting:
The text was updated successfully, but these errors were encountered: