citeproc-ruby icon indicating copy to clipboard operation
citeproc-ruby copied to clipboard

How to add a new output format?

Open retorquere opened this issue 6 years ago • 3 comments

I'm looking to create an output format that outputs ansi console codes -- any tips on where to start on creating a new output format?

retorquere avatar May 09 '19 09:05 retorquere

You can see the current formats here. To create a new format you need to sub-class Format and override any of the methods here and add apply_* methods for any CSL formatting directive you wish to implement (e.g., apply_font_style, apply_vertical_align, etc.).

inukshuk avatar May 09 '19 09:05 inukshuk

Interesting -- I thought styles could apply stuff like bold and italics (I once created a markdown format inside Zotero) but I don't see any of it here. Maybe this isn't required though for my case and I could just stick to the plain format.

retorquere avatar May 09 '19 10:05 retorquere

Yes, for those you need to implement apply_font_weight and apply_font_style. Take a look at the html format as an example: it maps those to CSS styles or uses <b>, <i> tags (that's an internal configuration option used by the format).

inukshuk avatar May 09 '19 11:05 inukshuk