Open hadley opened 12 years ago
Some notes on customising redcarpet (ruby bindings for sundown): http://dev.af83.com/2012/02/27/howto-extend-the-redcarpet2-markdown-lib.html. Example of custom man page renderer: https://github.com/vmg/redcarpet/blob/master/lib/redcarpet/render_man.rb. More hints on callbacks from python binding: http://misaka.61924.nl/manual/#toc_14
Potential mapping between mark and Rd:
\link[=dest]{name}
)Should probably autolink any function calls in R code.
Also need some way of including literal Rd tags.
Creating a custom renderer from R:
Call sequence:
markdownToHTML
renderMarkdown
.Call(rmd_render_markdown)
which finds armd_renderer
given a string, then callsrenderer(name)->render(ib,ob,Soptions,Sextensions)
An
rmd_renderer
is defined as:or maybe
depending on whether you're looking in
include/markdown_rstubs.h
orsrc/markdown.h
. It looks like you can register your own rendered withrmd_register_renderer
, but that doesn't seem to be used anywhere in the source. Instead the default html rendered is set inrmd_init_renderer_list
:Thus the key function is
render_to_html
. That function parses extensions and options, then the key code seems to be:sdhtml_renderer
takes a pointer to a callback struct and fills it in with functions calledrndr_*
, which look like (e.g.)The possible call backs are enumerated in
sd_callbacks
:Probably easiest to proceed by creating way of mapping from R functions into this call back structure - that way I can write more effectively in R.