MCPcopy Create free account
hub / github.com/openai/plugins / _text

Function _text

plugins/codex-security/scripts/report_projection.py:39–53  ·  view source on GitHub ↗
(value: Any, fallback: str)

Source from the content-addressed store, hash-verified

37
38
39def _text(value: Any, fallback: str) -> str:
40 candidate = value if isinstance(value, str) and value.strip() else fallback
41 normalized = " ".join(candidate.split())
42 if not normalized:
43 return ""
44 if re.match(r"^(?:#{1,6}\s|[-*+]\s|>\s|```|\d+\.\s|\|)", normalized):
45 normalized = f"Text: {normalized}"
46 rendered: list[str] = []
47 cursor = 0
48 for match in re.finditer(r"(?<!`)`([^`\n]+)`(?!`)", normalized):
49 rendered.append(_escape_markdown_text(normalized[cursor : match.start()]))
50 rendered.append(f"`{match.group(1)}`")
51 cursor = match.end()
52 rendered.append(_escape_markdown_text(normalized[cursor:]))
53 return "".join(rendered)
54
55
56def _escape_markdown_text(value: str) -> str:

Callers 6

_stringsFunction · 0.85
_cellFunction · 0.85
_code_evidence_linesFunction · 0.85
_target_scope_linesFunction · 0.85
_finding_sectionFunction · 0.85
build_report_markdownFunction · 0.85

Calls 2

_escape_markdown_textFunction · 0.85
groupMethod · 0.80

Tested by

no test coverage detected