mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

Typst export doesn't support cards

Open agoose77 opened this issue 1 year ago • 1 comments

Description

Typst exports fail to produce anything meaningful for cards.

Proposed solution

We can implement a simple card function for this, something like:

const card = `#let card(body, title: none, header: none, footer: none, color: gray) = {
  let stroke = 1pt + color
  let _header
  let _footer
  if header != none {
    _header = block(width: 100%, inset: (x: 8pt, y: 4pt), fill: none, stroke: stroke, below: 0pt, radius: (top-right: 2pt))[#header]
  }
  if footer != none {
    _footer = block(width: 100%, inset: (x: 8pt, y: 4pt), fill: none, stroke: stroke, radius: (top-right: 2pt))[#footer]
  }
  block(width: 100%, stroke: stroke, [
    #_header
    #block(fill: none, width: 100%, inset: (x: 8pt, y: 4pt), radius: (bottom-right: 2pt), above: 1em, below: 1em)[
    
      #text(weight: "bold")[#title]
      
      #body
    ]
    #_footer
])
}`;

Additional notes

agoose77 avatar Mar 07 '24 18:03 agoose77

I will try and get to this, having already written the function.

agoose77 avatar Mar 07 '24 18:03 agoose77