navicore / teams-notification-resource

for Concourse CI notifications on Microsoft Teams
MIT License
32 stars 33 forks source link

unable/difficult to render html in messages #40

Open rcousineau-xandr opened 1 year ago

rcousineau-xandr commented 1 year ago

in the evaluate function, parentheses and colons are escaped:

function evaluate {
  __var=$1
  # escape ( and ) from markdown
  __var="${__var//\(/\\(}"
  __var="${__var//\)/\\)}"
  __var="${__var//\:/\\:}"
  __var=`eval echo $__var`
  echo $__var
}

i'm trying to send a message that includes <pre> which I know is possible (did it with a bot) in Teams messages

the error I got was:

/opt/resource/out: eval: line 16: syntax error near unexpected token `newline'

tried quoting the message like so:

          text: |
            "The **$BUILD_JOB_NAME** job FAILED ($BUILD_PIPELINE_NAME)<pre>test</pre>"

and was greeted with a new error:

Newtonsoft.Json.JsonReaderException: Bad JSON escape sequence: \(. Path 'text', line 1, position 67.

I don't know if more symbols need to be escaped, or if I need to escape the brackets in the yaml, or if this is simply impossible because of bash...