Skip to content
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

Make collected link refs available to converters #516

Open
mojavelinux opened this issue May 20, 2018 · 5 comments
Open

Make collected link refs available to converters #516

mojavelinux opened this issue May 20, 2018 · 5 comments
Assignees

Comments

@mojavelinux
Copy link
Contributor

When converting back to a lightweight markup syntax (such as Markdown to Markdown) it would be helpful if the link defs found by the parser were made available to the converter (either via the AST or converter options). This would allow references to be restored. Currently, this information is dropped once parsing is complete and all signs of these link refs vanish from the parsed tree.

I'd be happy to work on a proposed change if this idea is accepted.

@mojavelinux mojavelinux changed the title Make collected link refs available to the converter Make collected link refs available to converters May 20, 2018
@gettalong gettalong self-assigned this May 23, 2018
@gettalong
Copy link
Owner

Thanks for the proposal!

Some thoughts:

  • How would you want to store the link ID? In normalized form?

  • There can be multiple different link IDs for one normalized link ID - how would you handle this case?

  • What would be the advantage of storing this information in the options? I think it would better go into the root node of the AST.

@mojavelinux
Copy link
Contributor Author

How would you want to store the link ID? In normalized form?

I'd probably go with the same form that is used to pass links to the :link_defs option. That way, it's consistent and expected.

There can be multiple different link IDs for one normalized link ID - how would you handle this case?

Personally, I'm only interested in the last one that wins. But I understand that others might want to have all of them. If we go down that path, then I would assume each ID would be mapped to an array.

What would be the advantage of storing this information in the options? I think it would better go into the root node of the AST.

That works for me!

@gettalong
Copy link
Owner

How would you want to store the link ID? In normalized form?

I'd probably go with the same form that is used to pass links to the :link_defs option. That way, it's consistent and expected.

Okay, so the normalized form than since the link IDs passed via the :link_defs option get normalized.

There can be multiple different link IDs for one normalized link ID - how would you handle this case?

Personally, I'm only interested in the last one that wins. But I understand that others might want to have all of them. If we go down that path, then I would assume each ID would be mapped to an array.

Since we will use the normalized link ID, this won't be a problem.

What would be the advantage of storing this information in the options? I think it would better go into the root node of the AST.

That works for me!

Great! Then the root node of the AST it is.

@mojavelinux
Copy link
Contributor Author

I'll proceed with preparing a PR as soon as I get a chance.

@gettalong
Copy link
Owner

gettalong commented Apr 16, 2020

@mojavelinux Did you by chance prepare a PR for this? Is this still of interest to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants