Skip to content
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

html output of code-block includes extra line breaks #27

Open
xrme opened this issue Sep 26, 2024 · 0 comments
Open

html output of code-block includes extra line breaks #27

xrme opened this issue Sep 26, 2024 · 0 comments

Comments

@xrme
Copy link
Member

xrme commented Sep 26, 2024

From this:

;;; -*- Mode: Lisp; Package: CCL; Coding: utf-8; -*-

(document "bug in code-block"
  (code-block "#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <pwd.h>

int bufsize;

if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
  abort();

char buffer[bufsize];
struct passwd pwd, *result = NULL;
if (getpwuid_r(getuid(), &pwd, buffer, bufsize, &result) != 0 || !result)
  abort();

printf(\"%s\n\", pwd.pw_dir);"))

We get the output:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
bug in code-block</title>
</head>
<body>
<header><h1>bug in code-block</h1></header>
<div id="main-wrapper">  <div id="toc"><div class="sidebar">
<h2>Table of Contents</h2><nav><ul>
</ul>
</nav></div>
  </div>  <div id="contents-wrapper">    <div id="contents"><pre><code><p>#include &lt;sys/types.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;pwd.h&gt;</p>
<p>int bufsize;</p>
<p>if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
  abort();</p>
<p>char buffer[bufsize];
struct passwd pwd, *result = NULL;
if (getpwuid_r(getuid(), &amp;pwd, buffer, bufsize, &amp;result) != 0 || !result)
  abort();</p>
<p>printf("%sn", pwd.pw_dir);</p>
</code>
</pre>
    </div>  </div></div></body>
</html>

We need to respect whitespace and line breaks in the code-block. We don't want paragraphs in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant