Marker.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Services\Markup\Annotation;
  3. /**
  4. * 一个批注标记:{@see AnnotationSet} 在源码里留下的占位符对应的结构化内容。
  5. *
  6. * - point:一个点,解析成一个模板调用(脚注、句尾图标)
  7. * - open / close:一对区间边界(同一个 pair),解析后包住中间的内容(issue 高亮)
  8. */
  9. final readonly class Marker
  10. {
  11. public const OPEN = 'open';
  12. public const CLOSE = 'close';
  13. public const POINT = 'point';
  14. /**
  15. * @param string $template 模板名:point 与 open 用(close 跟随 open)
  16. * @param array<string, string> $params 命名参数
  17. * @param string|null $body note 的正文(markdown),解析成 text slot
  18. * @param string $bodyContentType note 正文的方言(批注是 discussions 的一行,方言跟着它,不跟句子)
  19. */
  20. public function __construct(
  21. public string $kind,
  22. public int $pair = 0,
  23. public string $template = '',
  24. public array $params = [],
  25. public ?string $body = null,
  26. public string $bodyContentType = 'markdown',
  27. ) {}
  28. }