Ticket #201 (closed enhancement: fixed)

Opened 2 years ago

Last modified 6 months ago

Strip one leading blank from each line of a code block, if possible

Reported by: SimonHengel Owned by: Fūzetsu
Priority: minor Milestone:
Version: 2.9.4 Keywords:
Cc:

Description

Most people (including me) tend put a leading blank on each non-empty line of a code block.

Say

-- > foobar

instead of

-- >foobar

(e.g. test-framework-th contains real world examples)

The generated HTML documentation retains these leading blanks. And if you copy&paste some example snippets from the documentation, you end up striping these leading blanks manually.

This has annoyed me several times. So I suggest to strip (in the parser) exactly one leading blank from each non-empty line of a code block iff each non-empty line of that code block starts with a blank.

In addition I'd adjust the default CSS to make up for the missing blank.

Change History

Changed 2 years ago by SimonHengel

  • priority changed from major to minor

Changed 2 years ago by waern

Fine with me!

Changed 2 years ago by anonymous

  • milestone 2.10.0 deleted

Milestone 2.10.0 deleted

Changed 8 months ago by Fūzetsu

  • owner set to Fūzetsu

I'll implement this later although I'm not going to be messing with CSS to make it look like it has a blank after we strip it because then it becomes not possible to show something without the blank: if someone really needs the blank to show in the end, they can use two spaces or something; the use-case in the OP is the much more common one.

Changed 7 months ago by haasn

This is partially implemented in fc7fd18. Current behavior is to strip (uniform) leading spaces from bird tracks, but @ @-style code blocks are still left untouched.

Is that a priority, too?

Changed 7 months ago by Fūzetsu

It'd certainly be very nice to have. I think most people use @ style and the comments look like

-- @ -- foo -- bar -- @

And because of the space before the closing @, they get a spurious line. If we could strip the space then it'd look much better in those cases.

Changed 6 months ago by Fūzetsu

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.