ankitpokhrel / jira-cli

🔥 Feature-rich interactive Jira command line.
MIT License
3.92k stars 199 forks source link

Template content get escaped in {noformat}/{code} tags #635

Open olivergondza opened 1 year ago

olivergondza commented 1 year ago

Describe the bug

Template content get incorrectly escaped in {noformat}/{code} tags.

Please provide following details

  1. JiraCLI Version:
    1.4.0-1
    (Version="v0.0.0-dev", GitCommit="", CommitDate="", GoVersion="go1.20.4", Compiler="gc", Platform="linux/amd64")
  2. Are you using Jira cloud or on-premise jira server?
    
    SERVER INFO
    -----------

Version: 9.4.2 Build Number: 940002 Deployment Type: Server Default Locale:

3. What operating system are you using? Also mention version.

Linux arch 6.3.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023 20:10:31 +0000 x86_64 GNU/Linux

5. What terminal are you using? Also mention version.

kitty 0.28.1

No interactive features involved here, though.

**To Reproduce**

### Steps to reproduce the behavior:

Using `jira issue create --project CCITJEN --type Story --summary "Test" --template ./template --no-input`. with the `./template`:

Careful with the dashes ({{-}}), square-brackets ({{[}} and {{]}}), and exclamation marks({{!}})!

{code} Careful with the dashes (-), square-brackets ([ and ]), and exclamation marks! {code}

{noformat} Careful with the dashes (-), square-brackets ([ and ]), and exclamation marks! {noformat}


### Actual behavior

What I see in JIRA UI issue body is
![Screenshot from 2023-06-21 15-11-46](https://github.com/ankitpokhrel/jira-cli/assets/206841/170ff78c-d89b-4876-bb7d-847a06074ab6)

The markdown presented on text edit is:

Careful with the dashes ({{-}}), square-brackets ({{[}} and {{]}}), and exclamation marks({{!}})!

{code} Careful with the dashes (-), square-brackets ([ and ]), and exclamation marks! {code}

{noformat} Careful with the dashes (-), square-brackets ([ and ]), and exclamation marks! {noformat}



### Expected behavior

- The description to be presented as if the content were pasted into UI edit text window.
  - ![Screenshot from 2023-06-21 15-20-40](https://github.com/ankitpokhrel/jira-cli/assets/206841/d9803d73-d64c-4bf7-93e7-a4ef75081569)
  - (Apparently, it is not satisfied with the `{{[}}`. Ironically when I let the WYSIWYG editor in JIRA to convert `[` in preformatted test, it uses this. Though it is unrelated to this issue.)
- The markdown presented on JIRA UI edit to be more or less identical. Now it is infested with backslashes.
funcode commented 1 year ago

This probably is due to the same cause as #407. After I changed md.ToJiraMD to return the input string immediately without doing anything, the markdown works well, except for ({{[}} and {{]}}).