[-- Attachment #1: Type: text/plain, Size: 956 bytes --] Hi, folks — First of all, many thanks to the contributors for their work on Org-Mode. I'm a happy (novice) user; first time poster here. :-) I have a seemingly trivial aesthetic problem. I've attached the reproducer .org file and its HTML export to demonstrate it. I'm sure advanced users might recognize the problem immediately. As you notice in my HTML export: An unwanted new line is added between "Test 3" and "sub bullet under test 3, with a quote" (which uses BEGIN_QUOTE/END_QUOTE in the .org file). Likewise, a new line is added before "Test 4" starts. And yet again, a new line under "Test 6" and its sub bullet. Is there a way to avoid the said new lines in the above mentioned examples? (NB: A space right _before_ the quote starts is okay.) Or alternatively, is there a way to consistently force a new line in the HTML export, after each of "Test 1", "Test 2", et al? Many thanks in advance! Regards, Kashyap [-- Attachment #2: reproducer_spacing.html --] [-- Type: text/html, Size: 10824 bytes --] [-- Attachment #3: reproducer_spacing.org --] [-- Type: application/octet-stream, Size: 1074 bytes --] #+TITLE: Demonstrate broken spacing when quoting paragraphs #+OPTIONS: \n:t #+OPTIONS: html-postamble:nil 1. Test 1 2. Test 2 - sub bullet under test 2 3. Test 3 - sub bullet under test 3, with a quote: #+BEGIN_QUOTE Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. #+END_QUOTE 4. Test 4 - sub bullet under test 4 5. Test 5 - sub bullet under test 5 6. Test 6 - sub bullet under test-6, with another quote: #+BEGIN_QUOTE Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. #+END_QUOTE 7. Test 7 - sub bullet under test 7, with yet another quote: #+BEGIN_QUOTE Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. #+END_QUOTE 8. Test 8 - sub bullet under test 8
Hello, Kashyap Chamarthy <kashyap.cv@gmail.com> writes: > Is there a way to avoid the said new lines in the above mentioned > examples? (NB: A space right _before_ the quote starts is okay.) Or > alternatively, is there a way to consistently force a new line in the > HTML export, after each of "Test 1", "Test 2", et al? A solution could be to 'force' a homogeneous space between all the items of the list by modifying the 'margin' property (https://www.w3schools.com/cssref/pr_margin.asp). For example: #+HTML_HEAD: <style> li{margin: 15px;}</style> Regards, Juan Manuel
[-- Attachment #1: Type: text/plain, Size: 2059 bytes --] Hi Kashyap, The problem seems to be that when the HTML exporter finds more than one element within a list item, it wraps each one in its own set of =<p>...</p>= tags, which creates the additional space. You can see that this has nothing to do with the quotes, just inserting a second paragraph within the list item triggers this, e.g.: ------ 3. Test 3 - sub bullet under test 3, with a quote: another paragraph within the bullet ------ As Juan Manuel suggested, one way to fix the visual difference is with CSS. To be more selective, you could style only <p> items with a <li>, like this: #+HTML_HEAD: <style>li p { margin: 0em; }</style> In my test, this eliminates the spacing before those items, making them all look the same in the browser. Looking at the ox-html code, there doesn't seem to be a way to prevent this from happening at the moment, a plain paragraph is always wrapped in <p> tags. Hope this helps, --Diego On Sun, Dec 27, 2020 at 2:03 PM Kashyap Chamarthy <kashyap.cv@gmail.com> wrote: > Hi, folks — > > First of all, many thanks to the contributors for their work on > Org-Mode. I'm a happy (novice) user; first time poster here. :-) > > I have a seemingly trivial aesthetic problem. I've attached the > reproducer .org file and its HTML export to demonstrate it. I'm sure > advanced users might recognize the problem immediately. As you notice > in my HTML export: An unwanted new line is added between "Test 3" and > "sub bullet under test 3, with a quote" (which uses > BEGIN_QUOTE/END_QUOTE in the .org file). Likewise, a new line is added > before "Test 4" starts. And yet again, a new line under "Test 6" and > its sub bullet. > > Is there a way to avoid the said new lines in the above mentioned > examples? (NB: A space right _before_ the quote starts is okay.) Or > alternatively, is there a way to consistently force a new line in the > HTML export, after each of "Test 1", "Test 2", et al? > > Many thanks in advance! > > Regards, > Kashyap > [-- Attachment #2: Type: text/html, Size: 2721 bytes --]
On Sun, Dec 27, 2020 at 4:53 PM Diego Zamboni <diego@zzamboni.org> wrote: > > Hi Kashyap, Hi, Diego > The problem seems to be that when the HTML exporter finds more than one element within a list item, it wraps each one in its own set of =<p>...</p>= tags, which creates the additional space. You can see that this has nothing to do with the quotes, just inserting a second paragraph within the list item triggers this, e.g.: Ah, I see. So it's any element within a list item that's wrapped in paragraph tags. > ------ > 3. Test 3 > - sub bullet under test 3, with a quote: > > another paragraph within the bullet > ------ > > As Juan Manuel suggested, one way to fix the visual difference is with CSS. To be more selective, you could style only <p> items with a <li>, like this: > > #+HTML_HEAD: <style>li p { margin: 0em; }</style> Hmm, that fixes the new line before the "sub bullet under test 3, with a quote". However, a new line still remains after the quote ends (and before the "Test 4" starts). Is it possible to nuke that too? If not, that's okay, I can live with it. :-) > In my test, this eliminates the spacing before those items, making them all look the same in the browser. > > Looking at the ox-html code, there doesn't seem to be a way to prevent this from happening at the moment, a plain paragraph is always wrapped in <p> tags. Thanks for taking the time to look at the code. [...] /kashyap
Hello again Kashyap,
Kashyap Chamarthy <kashyap.cv@gmail.com> writes:
> Hmm, that fixes the new line before the "sub bullet under test 3, with
> a quote". However, a new line still remains after the quote ends (and
> before the "Test 4" starts). Is it possible to nuke that too? If
> not, that's okay, I can live with it. :-)
I'd say a vertical space before and after a block quote would be
'typographically' correct. But if you want to eliminate the space after
the block quote, without having to modify it in a general way, it could
be solved with a bit of Elisp, by defining a custom filter so that the
<blockquote> tag would be modified only within a plain list. Thus, with the
configuration that Diego has suggested, everything would be without
vertical space except the space before each block quote:
#+BIND: org-export-filter-plain-list-functions (my-filter-html)
#+begin_src emacs-lisp :exports results :results none
(defun my-filter-html (text backend info)
(when (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string "<blockquote>" "<blockquote style=\"margin-bottom:0px\">" text)))
#+end_src
Regards,
Juan Manuel
On Sun, Dec 27, 2020 at 8:17 PM Juan Manuel Macías <maciaschain@posteo.net> wrote: > > Hello again Kashyap, Hey, Juan > Kashyap Chamarthy <kashyap.cv@gmail.com> writes: > > > Hmm, that fixes the new line before the "sub bullet under test 3, with > > a quote". However, a new line still remains after the quote ends (and > > before the "Test 4" starts). Is it possible to nuke that too? If > > not, that's okay, I can live with it. :-) > > I'd say a vertical space before and after a block quote would be > 'typographically' correct. You're right, and I agree. > But if you want to eliminate the space after > the block quote, without having to modify it in a general way, it could > be solved with a bit of Elisp, by defining a custom filter so that the > <blockquote> tag would be modified only within a plain list. Thus, with the > configuration that Diego has suggested, everything would be without > vertical space except the space before each block quote: > > #+BIND: org-export-filter-plain-list-functions (my-filter-html) > #+begin_src emacs-lisp :exports results :results none > (defun my-filter-html (text backend info) > (when (org-export-derived-backend-p backend 'html) > (replace-regexp-in-string "<blockquote>" "<blockquote style=\"margin-bottom:0px\">" text))) > #+end_src Thank you for the code snippet. My only use of Emacs is Org-Mode, so I haven't spent much time learning Elisp yet. Regards, Kashyap
[-- Attachment #1: Type: text/plain, Size: 383 bytes --] > > Hmm, that fixes the new line before the "sub bullet under test 3, with > a quote". However, a new line still remains after the quote ends (and > before the "Test 4" starts). Is it possible to nuke that too? If > not, that's okay, I can live with it. :-) > That should be possible with CSS as well, but as I'm not a CSS expert, I'll leave it for you to figure out :) --Diego [-- Attachment #2: Type: text/html, Size: 675 bytes --]