This object is in archive! 

Indentation in code blocks

Archived Konstantin 11 years ago

When I put some text into code block, all indentation is removed. The source code looks awful:


  1. public class Main {
  2. private MainFrame frame;
  3. public static void main(String[] args) {
  4. final Main main = new Main();
  5. main.initLogging();
  6. }
  7. }

Replies (11)

photo
1

Konstantin,


In order to insert the code block correctly you need to paste you code then apply selection on it, after click on "code" formatting button.

In one of the next versions we'll improve this function.

photo
1

Sorry, but I did exactly what you suggested - pasted text, selected it, than applied "code" on the selection. It is shown correctly only until it is published. When you press "Post", all indents disappear.

photo
1

Konstantin wrote:

Sorry, but I did exactly what you suggested - pasted text, selected it, than applied "code" on the selection. It is shown correctly only until it is published. When you press "Post", all indents disappear.
Now I'm understood you.

What browser/version are you using? I just checked it with Chrome and Firefox without any problems.

Example:

  1. public class Main {
  2. private MainFrame frame;
  3. public static void main(String[] args) {
  4. final Main main = new Main();
  5. main.initLogging();
  6. }
  7. }

photo
1

Well, it seems I didn't explain clearly what I meant by indents. Please look at the attached file, it shows the source of this example text. And when I paste it and apply "code", it looks as needed, but only before publishing (see second file).


  1. public class Main {
  2. private MainFrame frame;
  3. public static void main(String[] args) {
  4. final Main main = new Main();
  5. main.initLogging();
  6. }
  7. }

photo
1

As I asked you: What browser/version are you using?

I've tested it once again and still have no problem with displaying formatted code.

photo
1

Chromium Version 28.0.1500.71 Ubuntu 13.04 (28.0.1500.71-0ubuntu1.13.04.1)

Chrome Версия 29.0.1547.57 m on Windows 7

Firefox 23.0


Could you please insert here a formatted code fragment? Or the example you provided in your second comment is supposed to be viewed with indents? I attach the screenshot as I see it.

photo
1

I just copied it from your response and paste it to notepad to make it as plain text.

After I paste text into UseResponse rich-text editor and apply "code" formatting.


  1. public class Main {
  2. private MainFrame frame;
  3. public static void main(String[] args) {
  4. final Main main = new Main();
  5. main.initLogging();
  6. }
  7. }

Works perfectly both in Chrome 29 and Firefox 23.

photo
1

OK, I'll try to explain my problem in other words. Please look at the screenshot attached to this comment. Is it possible to insert it into post and keep all indents?

If possible, could you demonstrate here such code fragment? As I stated previously, I see here all code aligned to the left side, without indents.

photo
1

This function doesт't provide full formatting capabilities to insert the code with indents

keeping. All indents will be omitted, only the code with line numbers.

photo
1

Do we have any chance to get this feature working, or any workaround? We don't need "full formatting capabilities", just indentation.


If your "code" formatting feature is intended for code in programming languages, indents are much more important than line numbers or fancy colors. In some languages (Python) indents even have semantic meaning!


I'm asking because we are going to use UseResponce for software developers support, so exchanging code fragments and publishing them in the Knowledge Base is essential for us. Luckily we don't use Python, mostly Java and XML, but anyway without indents the code is unreadable.


Of course it is our fault that we overlooked this issue before purchasing the license, but the button "code" looked convincing enough. Now we need your suggestion.


Thank you

photo
1

Konstantin,

We are sorry, but at the moment there is no support for a code indenting.

We'll consider your wishes to the next versions of the product.

Replies have been locked on this page!