New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problematic whitespace needs removing #924
Comments
Whitespace is rendered in inline and inline-block elements. While an inline You can work around the whitespace in CSS by having a negative left margin which is as wide as a space character, but that's going to render slightly differently with each font, so fixing it in the doku engine would be better. Then again, fixing it in doku might mess up templates that unknowingly depend on that extra space. |
DokuWiki was created (2004) before the glorious Firebug existed (2006). Back in the day adding a couple of new lines was the only way to keep code readable and therefore maintainable. But nowadays with code inspectors being the normality, I would vote for getting rid of a lot of new lines in the DokuWiki output. |
@selfthinker I'm fine with removing superfluous whitespace. PR welcome. |
The only superfluous whitespace that needs to be removed in order to solve this problem is the whitespace generated immediately before closing tags. More specifically,
Could be generated as:
This should be the smallest change necessary to fix the problem. I've no strong opinion on whether other whitespace should be removed. It may be useful for those who want to be able to inspect the code by eyeball though. The key issue is to remove any superfluous whitespace that actually gets rendered by the web browser. |
All spaces matter in inline elements, so the leading spaces would also have to be removed. |
There are no superfluous space characters in the code. The code contains superfluous carriage returns, which the html parser then (correctly according to standards) renders as a space character. If keeping the generated code human-readable is considered important, perhaps the carriage returns could be generated before the opening tag and after the closing tag, rather than how it is at present (after the opening tag and before the closing tag). |
Since Firebug it is no longer necessary to structure html with linebreaks. See also Issue #924
Hi @Ashtagon, I have just come here from a forum thread titled "how to remove unwanted space rendered by line break char in multiline paragraph". As I wrote today at the forum thread, superfluous carriage returns / linebreaks can be removed using a render type plugin components. For your convenience, you may try my LineBreak2 plugin package. I do not know well whether it will be a practical solution for your issue. Anyway, removing
|
Created syntax tag '{{task>form>namespace}}' to only show the new task form without a task list. Closes #31.
The standard list syntax generates the following html code:
Note that there are carriage returns before and after the actual rendered text.
I'm doing some advanced manipulation of the way lists render using css, and that whitespace is causing a problem.
Digression: The normal rendering for a list is:
I want it to render as:
one; two; three
I am using the wrap plugin to generate custom css code. I use content:after css to insert semi-colons, and set the display of each
<li>
element to inline. The carriage return whitespace before and after the text in the html code gets rendered as a space when display: inline is set, because that whitespace is no long at the beginning or end of a block.My custom css for use with the wrap plugin is:
Is there a css-based solution to this problem, or can this only be fixed by forcing the dokuwiki engine to stop generating the superfluous carriage returns. If the latter, how would I edit the php code to fix the problem?
ETA: I ran a test in which I saved the generated html page to my desktop, edited out those whitespaces manually, then reloaded it. The resulting page displayed as expected, with the extra space characters removed. This confirms that it is those carriage return characters that are getting rendered as spaces.
First reported at forum: https://forum.dokuwiki.org/post/46068
The text was updated successfully, but these errors were encountered: