« Home

Feature. tr/code [trcode]

@tr/code{...} is a new feature to help users create their own extension for card, for example, you can add math macro

@tr/code{#lang racket
(provide (all-defined-out))

(define RR "\\mathbb{R}")
}

Or use this to fetch cards you want to transclude:

@tr/code{
(require tr/metadata)

(define scrbl-list (find-files (lambda (x) (string-contains? (path->string (file-name-from-path x)) "guide")) "content"))
(define addr-list
  (for/list ([path scrbl-list])
    (compute-addr path)))
}

Then I can use @ol[@(for/list ([addr addr-list]) (li addr))] to list these addresses:

  1. guide-0000
  2. guide-0001
  3. guide-0002
  4. guide-0003
  5. guide-0004
  6. guide-0005
  7. guide-0006
  8. guide-0007
  9. guide-0008

The form can be placed as any top-level form, so you can have

@tr/code{...}
@p{...}
@tr/code{...}

But you must have #lang [language] line in the first @tr/code{...} to decide your language.