6

The post looks different when in edit mode with respect to how it looks once it is saved. See for example this answer, and specifically the last two lines at the bottom.

In edit mode, I managed to display a single blank line between the two lines of code, but when the post was saved a larger (double) blank line appeared instead.

Edit mode: enter image description here

Saved post: enter image description here

I believe the preview and final version should be consistent, so I'd like to report this as a bug.

1 Answer 1

3

To display a single blank line between your two code lines you can separate them using:

<!-- comment -->

Followed by a blank line:

awk 'BEGIN {RS="\0"} {match($0,/templateUrl: .*/,m); gsub("templateUrl: .*","templateUrl: templateUrl"); print "var "m[0]$0}' *
<!-- comment -->

awk -i '/templateUrl: / {a=$1" "$2;gsub("templateUrl: .*","templateUrl: templateUrl")} NR==1 {file=$0} NR==2{file=file"\n"$0} END{print a"\n"file}' *

This displays as:

awk 'BEGIN {RS="\0"} {match($0,/templateUrl: .*/,m); gsub("templateUrl: .*","templateUrl: templateUrl"); print "var "m[0]$0}' *
awk -i '/templateUrl: / {a=$1" "$2;gsub("templateUrl: .*","templateUrl: templateUrl")} NR==1 {file=$0} NR==2{file=file"\n"$0} END{print a"\n"file}' *

I've updated your answer :)

3
  • Thanks a lot for the workaround! Would you say this bug is not worth reporting?
    – simlev
    Aug 2, 2017 at 15:46
  • 1
    @simlev I'd say it's worth reporting because the editor preview should show users how their post is going to look. It's very nice that there's a way to make the final version display as you want, but there's still a discrepancy between the preview and the final version.
    – Ben N
    Aug 2, 2017 at 15:49
  • @simlev I would leave it in case anyone else has the same issue. There are so many odd corner cases to markdown formatting that it is unlikely to get fixed soon.
    – DavidPostill Mod
    Aug 2, 2017 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .