Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-26030

Pasting code into a code block in Confluence looses existing formatting of the code

      We are currently running Confluence 4.0.4 so if this is fixed in a later version great, let me know.

      If I take code blocks from a text editor and paste it into a code block in confluence it looses all of the existing formatting. This is extremely frustrating when dealing with things like JSON or XML fragments which can be fairly large and require a lot of reformatting to make them presentable. When I am pasting into a code block I expect the contents to be placed into the editor without stripping existing formatting.

            [CONFSERVER-26030] Pasting code into a code block in Confluence looses existing formatting of the code

            This is still an issue, 6 years later.

            Roman Mondello added a comment - This is still an issue, 6 years later.

            I am trying to add code for a drop down navigation menu and it just won't work. Is there some setting that will allow this code to activate the drop down functionality?

            Thanks,
            Kat

            Kathleen Newman added a comment - I am trying to add code for a drop down navigation menu and it just won't work. Is there some setting that will allow this code to activate the drop down functionality? Thanks, Kat

            Hi, I faced this issue today in Confluence 4.3.7,

            Tarun Sapra added a comment - Hi, I faced this issue today in Confluence 4.3.7,

            Unsure exactly when this was fixed but it no longer occurs in 4.2.8.

            Denise Unterwurzacher [Atlassian] (Inactive) added a comment - Unsure exactly when this was fixed but it no longer occurs in 4.2.8.

            I was able to reproduce this on 4.0.4 with php code and HTML, the line breaks remain but whitespace (both spaces and tabs in gedit) is trimmed and empty lines are removed.

            I have tested in Confluence 4.2.8 and this issue no longer occurs.

            Denise Unterwurzacher [Atlassian] (Inactive) added a comment - - edited I was able to reproduce this on 4.0.4 with php code and HTML, the line breaks remain but whitespace (both spaces and tabs in gedit) is trimmed and empty lines are removed. I have tested in Confluence 4.2.8 and this issue no longer occurs.

            Jarom added a comment -

            I have tried pasting from TextMate2 and MVIM. My formatting is lost from both editors. I am primarily dealing with JSON, XML, and Python code fragments. I think I have also tried pasting code from TextEdit but I could be remembering incorrectly. I use spaces instead of tabs in the editor if that makes any difference. I am running on OS X Lion 10.7.4.

            Jarom added a comment - I have tried pasting from TextMate2 and MVIM. My formatting is lost from both editors. I am primarily dealing with JSON, XML, and Python code fragments. I think I have also tried pasting code from TextEdit but I could be remembering incorrectly. I use spaces instead of tabs in the editor if that makes any difference. I am running on OS X Lion 10.7.4.

            My formatting sticks around when I paste. Just tried it from EMACS and IDEA. Mind saying what editor your using?

            wwalser (Inactive) added a comment - My formatting sticks around when I paste. Just tried it from EMACS and IDEA. Mind saying what editor your using?

              Unassigned Unassigned
              5986d827282d Jarom
              Affected customers:
              0 This affects my team
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: