Preserve References and Reference Information #339
williambanfield
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Hey!
I'm working on a tool to apply some simple and consistent markdown format rules to my markdown files. It takes an input markdown file and outputs the equivalent file with some spacing changes that will hopefully allow my markdown files to look and feel consistent.
I frequently use link references in my documents of the style
[link name][link-destination-reference]with the destination defined at the bottom of the file in a dedicated references section. I find this style aids readability of raw markdown documents.In using goldmark to build this tool, I notice that the
ast.Linknode does not preserve the original destination of[link-destination-reference]and instead resolves the reference and leaves the renderer with the actual URL, as if the document had instead contained the URL. I understand why this is useful for rendering HTML but it's not quite what I need for a tool that aims to only apply style changes to the original text of the markdown.I'd like to preserve information about the reference so that the renderer can instead output the original link style and I'm wondering how this might be achieved or if it would be possible for the
ast.Linktype to maintain information about the original reference if one exists?Additionally, the references themselves do not appear to be served to the rendered. The section of my document containing the definition of the references is not passed to the rendered. For example
[link-destination-reference]: github.com/yuin/goldmarkis never actually passed to the renderer and so my tool cannot write this back out to the document. I'm wondering how I may be able to preserve these.Perhaps there's something already provided in the library that I'm just missing. Any help would be greatly appreciated! The library is great so far so I'm hoping I can figure out how to get passed this hitch.
An example document of this style can be found here.
Beta Was this translation helpful? Give feedback.
All reactions