From 819e9998c8d5ca938a4e1f5b16a9fe3e77e703c5 Mon Sep 17 00:00:00 2001 From: Volker Christian Date: Mon, 25 Mar 2024 15:10:49 +0100 Subject: [PATCH] Fix: If opening is on the end of a line, merge it with the next line --- gh-md-toc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gh-md-toc b/gh-md-toc index 35239bf..16e5418 100755 --- a/gh-md-toc +++ b/gh-md-toc @@ -269,6 +269,13 @@ gh_toc_grab() { # # became: The command foo1 sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + + # if opening is on the end of a line, merge it with the next line + # for example: + # was:

+ # foo1

+ # became:

+ sed -e ':a' -e 'N' -e '$!ba' -e 's/heading-element">\n/heading-element">/g' | # Sometimes a line can start with . Fix that. sed -e ':a' -e 'N' -e '$!ba' -e 's/\n