public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: man page indent
Date: Sun, 20 Nov 2022 20:57:26 -0800	[thread overview]
Message-ID: <293E7EEC-B348-44C3-9533-1004F7F53B0E@gmail.com> (raw)
In-Reply-To: <71b3adff-5bd5-44b7-8448-97f4d7a910ban-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Pandoc needs to do something to format code blocks differently from ordinary paragraphs, since terminal pagers will use the same font for both.  So what it does is to put code blocks in indented paragraphs.  I'm open to reconsidering this, but we need SOME way to indicate that something is a code block.

Just looking around a bit:  the perl man pages indent code blocks too, but only 1 space from the main content.

man 3 strcmp indents examples 4 spaces relative to the main content, but the "Program Source" section is indented 0.

man 3 gethostbyaddr also indents code examples 4 spaces.

I'm not sure, based on my survey, whether there is in fact any standard for this.


> On Nov 20, 2022, at 1:10 PM, Rick Stanley <rick.stanley.inc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> Command: pandoc sample.3.md -o sample.3 -f markdown -s -t man
> ---
> title: XXX
> section: 3
> header: XXX
> footer: XXX 1.2.3.4
> date: YYYY-MM-DD
> ---
> 
> # NAME
> sample
> 
> # SYNOPSIS
> &nbsp;
> 
> # DESCRIPTION
> Sample
> 
> # EXAMPLES
> 
> __Program Source__
> 
> 
> ~~~~
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> int main(void)
> {
> 
>   printf("Test of markdown.\n");
> 
>   return EXIT_SUCCESS;
> }
> ~~~~
> 
> 
> On Sunday, November 20, 2022 at 3:36:44 PM UTC-5 fiddlosopher wrote:
> Sorry, I am not sure I follow. Please give a small example of the input you're using (markdown?). 
> 
> I don't see any difference between the indentation of the man page for pandoc and, say, emacs on my system. 
> 
> > On Nov 20, 2022, at 9:24 AM, Rick Stanley <rick.sta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: 
> > 
> > In any Standard Library man page, that displays example code, the line "Program Source" is indented by 4 spaces, and the source code is indented by 8. 
> > In creating my own man page, using pandoc, the "Program Source" line is indented by 8, and my source is indented by 16 spaces. I would prefer the same indentation for all my man pages. 
> > 
> > I don't have lua installed and would prefer not to use if if at all possible. I am writing pure C. 
> > 
> > Thank you! 
> > 
> > On Sunday, November 20, 2022 at 11:57:59 AM UTC-5 fiddlosopher wrote: 
> > Are you saying you want code blocks to be indented to the same level as the man page's body text? 
> > 
> > You could achieve that with a lua filter that resets paragraph indentation before each code block. Save this as unindent_code.lua: 
> > 
> > ``` 
> > function CodeBlock(el) 
> > return { pandoc.RawBlock("man", '.IP "" 0'), el } 
> > end 
> > ``` 
> > 
> > Then use --lua-filter unindent_code.lua on the command line when you convert to man. 
> > 
> > 
> > 
> > > On Nov 20, 2022, at 6:12 AM, Rick Stanley <rick.sta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: 
> > > 
> > > When using __Program Source__ in creating a man page, it indents 8 spaces not 4. How to manage the indent level when using pandoc? 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. 
> > > To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cbe22587-8440-4e39-861f-e2ccdcb4dd7an%40googlegroups.com. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> > To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/329d7440-178e-40c1-b4fa-2dadaea66295n%40googlegroups.com. 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/71b3adff-5bd5-44b7-8448-97f4d7a910ban%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/293E7EEC-B348-44C3-9533-1004F7F53B0E%40gmail.com.


  parent reply	other threads:[~2022-11-21  4:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 14:12 Rick Stanley
     [not found] ` <cbe22587-8440-4e39-861f-e2ccdcb4dd7an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-20 16:57   ` John MacFarlane
     [not found]     ` <EDFA0264-8B4A-4319-8477-265C3AD6ADC7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-11-20 17:24       ` Rick Stanley
     [not found]         ` <329d7440-178e-40c1-b4fa-2dadaea66295n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-20 20:36           ` John MacFarlane
     [not found]             ` <B263931A-0B66-4575-B91A-DC32A61BEE0F-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-11-20 21:10               ` Rick Stanley
     [not found]                 ` <71b3adff-5bd5-44b7-8448-97f4d7a910ban-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-21  4:57                   ` John MacFarlane [this message]
     [not found]                     ` <293E7EEC-B348-44C3-9533-1004F7F53B0E-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-11-21 14:30                       ` Rick Stanley
2022-11-20 21:22               ` Rick Stanley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=293E7EEC-B348-44C3-9533-1004F7F53B0E@gmail.com \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).