I'm interested in using Pandoc to write a generic Ctags emitter. However, I'm finding this is difficult because it seems impossible to connect a node to its original source code in the current API(s).

Is there any way to access the line number in the source file where a node first appears, from the Haskell API or the JSON formatted output? If not, is this something that would be feasible to track and expose?

Or, to stretch the idea a bit, would it be totally crazy to extend Pandoc with the ability to attach this kind of metadata to each node, or perhaps allow a reader to attach *arbitrary* metadata? In the latter case, the structure of the node-level metadata would be a matter of convention, and writers would be free to simply ignore it.

I'm asking about both the feasbility of implementation ("would it be possible without having to rewrite huge amounts of code?") and the desirability of implementation ("is this something the Pandoc project is interested in?").

For what it's worth, I don't envision this being useful solely for Ctags tag generation, although IMO a "format-agnostic" tag generator for dozens of markup formats that comes "for free" out of a single implementation seems like a good enough prize on its own, so long as you can easily add, say, "linenrStart", "linenrEnd", and/or "verbatimSource" attributes to the reader. You could also use this ability to create Pandoc-based code/text formatters and linters that introspect on the contents of nodes, or automatically inject a "view source for this section on GitHub" link into top-level headings.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9c830d97-68ca-4cda-8892-3cad8b2c975d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.