Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Code alignment incorrect while copying from codeblock

Avatar

Level 2

I have a document which is published as a PDF. There are multiple codeblocks containing code within the document. THe alignment of the code displayed in the PDF is correct.  When I copy the codeblock from the output and paste it in a txt file, I see that the alignment is not correct. The leading spaces are not shown, and so all the lines start at the same level. Is there any way to fix the alignment issue while copying the codeblock?

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @Anish2 ,

 

Offering some generic solutions that you can try -

1) Try pasting using the option retaining source formatting.

2) You can select the code block or even the entire code in the file and apply the code indentation using any IDE such as eclipse and IntelliJ. You can also configure the indentation using IDE settings.

3) Use any online code beautifier for your file.

Regards,

Manpreet

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

Hi @Anish2 ,

 

Offering some generic solutions that you can try -

1) Try pasting using the option retaining source formatting.

2) You can select the code block or even the entire code in the file and apply the code indentation using any IDE such as eclipse and IntelliJ. You can also configure the indentation using IDE settings.

3) Use any online code beautifier for your file.

Regards,

Manpreet