ob-http icon indicating copy to clipboard operation
ob-http copied to clipboard

Allow breaking long lines for readbility.

Open Kaligule opened this issue 3 years ago • 2 comments

Especially when working with a lot of query parameters it might be useful to split lines. Therefore, lines that start with \ (or whatever matches ob-http:join-line-marker) will be merged into the previous line before processing.

So the following lines would be equivalent:

#+BEGIN_SRC http
GET https://api.github.com/repos/zweifisch/ob-http/pulls
\?state=open
\&sort=created-asc
\&no-assignee
#+end_src
#+BEGIN_SRC http
GET https://api.github.com/repos/zweifisch/ob-http/pulls?state=open&sort=created-asc&no-assignee
#+end_src

Kaligule avatar Jan 31 '22 12:01 Kaligule

If backslashes must be used, I would find it more customary and natural to use them at the end of the previous line rather than the beginning of the next. But even better IMO, consistent with RFC 822, a continuation line should be indicated by whitespace at the beginning of the continued line. Just an opinion for consideration.

ewestbrook avatar Feb 01 '22 03:02 ewestbrook

@ewestbrook Awesome suggestion. The default value for ob-http:join-line-marker was \\\\ (which is the easiest regex for a single backslash I could find) but I now changed it to [ \t]+ (so one or more spaces or tabs).

Kaligule avatar Feb 01 '22 12:02 Kaligule