(value string)
| 471 | } |
| 472 | |
| 473 | func formatLink(value string) (*docs.Link, error) { |
| 474 | link := strings.TrimSpace(value) |
| 475 | if link == "" { |
| 476 | return nil, ValidationError("--link target cannot be empty") |
| 477 | } |
| 478 | |
| 479 | if target, ok := strings.CutPrefix(link, "#"); ok { |
| 480 | target = strings.TrimSpace(target) |
| 481 | if target == "" { |
| 482 | return nil, ValidationError("--link target cannot be empty") |
| 483 | } |
| 484 | |
| 485 | return &docs.Link{BookmarkId: target}, nil |
| 486 | } |
| 487 | |
| 488 | return &docs.Link{Url: link}, nil |
| 489 | } |
| 490 | |
| 491 | func formatNamedStyle(headingLevel *int, namedStyle string) (string, error) { |
| 492 | trimmed := strings.ToUpper(strings.TrimSpace(namedStyle)) |
no test coverage detected