cabo / kramdown-rfc

An XML2RFC (RFC799x) backend for Thomas Leitner's kramdown markdown parser
MIT License
195 stars 83 forks source link

Syntax for including a svg in a markdown file #190

Closed afressancourt closed 1 year ago

afressancourt commented 1 year ago

Hello,

I have some problems finding out what is the syntax to use to include a svg schema (drawn with Inkscape) in a draft with kramdown-rfc. Could you tell me what I need to use?

Besides, I am wondering if it is possible to use an alternative ASCII art version of the schema for the text RFC and the SVG in the PDF / HTML version of the document.

Thanks for your answer !

cabo commented 1 year ago

kramdown-rfc does not have specific support for this, so you just put down the XML, as I explained on the rfc-i list a year ago or so:

On 2022-05-25, at 15:26, Paul Duffy (paduffy) <[paduffy@cisco.com](mailto:paduffy@cisco.com)> wrote:

> Assuming my AliceAndBob SVG is 7996 compliant, how exactly would I include that into a Kramdown draft?

Exactly the same way you would include it in XML, as there is no special support for including SVG, e.g.

     <figure anchor="bitmap-as-sum">
       <name>Feature bitmap as a sum of feature bits</name>
       <artset>
         <artwork type="svg" src="foo.svg"/>
         <artwork type="ascii-art" name="" align="left" alt=""><![CDATA[           __ 52                       fc
version = \         present(fc)&nbsp;⋅&nbsp;2
         /__ fc = 0
]]></artwork>
       </artset>
     </figure>

(This example has a plaintext alternate.)

You probably also can replace

         <artwork type="svg" src="foo.svg"/>

by

         <artwork type="svg" >
{::include foo.svg}
         </artwork>

so you get one integrated XML file out, but I haven’t tested this.

I should probably not send this before testing it (beware the typographical quotes), but I have another meeting coming up…

Grüße, Carsten

As you can see, the alternative ASCII art is done using artset, and the svg can be external via src= or included.

afressancourt commented 1 year ago

Hello,

Thanks a lot for your answer. The XML modification is working perfectly.

I will try to see if I can propose something to integrate the double syntax in kramdown-rfc.

Best regards,

Antoine