Skip to content

What can arguments to placeholders contain? (§3.11.11 and §3.11.15) #676

@davidmalcolm

Description

@davidmalcolm

Within a §3.11 message object, the arguments array is shared for use by both text and markdown (if any), in that (quoting §3.11.5 Messages with placeholders):
" The plain text and formatted message strings MAY contain different numbers of placeholders.

· A given placeholder index SHALL have the same meaning in the plain text and formatted message strings (so they can be replaced with the same element of the arguments array)."

I'm hoping for clarification on the following points:

Can an argument contain any formatting, such as embedded links?

§3.11.5 Messages with placeholders has: "A given placeholder index SHALL have the same meaning in the plain text and formatted message strings (so they can be replaced with the same element of the arguments array)."
which to me suggests that every argument of the arguments array must be a plain string: no embedded links, and (probably) no markdown markup.

Should a consumer perform markdown processing before or after argument substitution?

Consider if an argument string contained markdown markup. According to
§3.11.5 Messages with placeholders: "When a SARIF consumer displays the message, it SHALL replace every occurrence of the placeholder {n} with the string value at index n in the arguments array." Does this happen before or after handing off the string to markdown rendering? Should arguments be "plain" strings? (in which case this ordering is moot)

Or should some kind of markdown escaping happen on arguments during substitution?

Consider e.g. this message:

{
  "text", "expressions:\n {0}\n {1}",
  "markdown": "expressions:\n {0}\n {1}",
  "arguments": ["* p",  "* q"]
}

A substitution of text leads to "expressions:\n * p\n *q" which would be rendered as something like:

expressions:
* p
* q

but naively subtituting, the markdown would become like:

expressions:

  • p
  • q

and thus the dereference operators in the text have become bullet-point markup.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions