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

[new feature] SCDOC format #10065

Open
AndersonTorres opened this issue Aug 7, 2024 · 7 comments
Open

[new feature] SCDOC format #10065

AndersonTorres opened this issue Aug 7, 2024 · 7 comments

Comments

@AndersonTorres
Copy link

AndersonTorres commented Aug 7, 2024

SCDOC git repo at sourcehut is a document format similar to Markdown, primarily used to be converted to manpages.

Describe your proposed improvement and the problem it solves.

Add scdoc format, as described at https://git.sr.ht/~sircmpwn/scdoc/tree/master/item/scdoc.5.scd

Describe alternatives you've considered.

None. The idea is, precisely, add it as an input that Pandoc can recognize and work with

@jgm
Copy link
Owner

jgm commented Aug 7, 2024

I guess my questions would be:

  1. when was this made?
  2. is it still maintained?
  3. how widely used is it?
  4. why would it be helpful to have a pandoc reader for this format? It seems to be a special-purpose tool for creating man pages. Of course, you can do that with pandoc, but why not just use scdoc to convert this format to man pages?

@AndersonTorres
Copy link
Author

AndersonTorres commented Aug 7, 2024

when was this made?

Seven years since the first commit, a4193949ec755b3848a803a9b02364eeddbb1455 at scdoc git.

is it still maintained?

Most recent commit from 6 months.

how widely used is it?

I believe many projects from Sourcehut use it.
A quick grep at Nixpkgs codebase returned 100 packages.

why would it be helpful to have a pandoc reader for this format? It seems to be a special-purpose tool for creating man pages. Of course, you can do that with pandoc, but why not just use scdoc to convert this format to man pages?

Hum, let me explain.

There is a project, say Cardboard, that is using Pandoc to convert a Markdown file to a manpage.

Pandoc is awesome for converting Markdown to manpage, it goes without saying.
However, Pandoc is too overkill for this. Pandoc has a big dependency, namely GHC.
Bringing all this machinery for the sole purpose of generating a manpage looks like the proverbial bazooka to kill a fly.

On the other hand, scdoc is crafted to be, according to its creator, "a man page generator that had no more dependencies than man itself".

So, the idea here is:

  1. use Pandoc to convert from Markdown to scdoc
  2. eventually clean and tidy up the resulting output manually
  3. remove the original Markdown input and commit the new scdoc
  4. change the build scripts in order to call scdoc instead of pandoc

@jgm
Copy link
Owner

jgm commented Aug 7, 2024

Thanks. Note: if you just want a lightweight, no dependency man page generator that uses markdown (commonmark) source, cmark itself can do this.
https://github.com/commonmark/cmark/blob/master/man/man1/cmark.1

@jgm
Copy link
Owner

jgm commented Aug 7, 2024

In your first comment you seem to want to use scdoc as an input format; in your reply, you talk of using pandoc to produce scdoc which would then be processed by scdoc itself. Seems that an scdoc writer would be more useful than a reader.

The format seems straightforward and fairly simple, if underspecified. (e.g. how much indent is required for a sublist? Can you include multiple paragraphs under list items, and if so how? if you can't, then what would a pandoc writer do with a list item containing multiple paragraphs?)

@AndersonTorres
Copy link
Author

AndersonTorres commented Aug 7, 2024

The format seems straightforward and fairly simple, if underspecified. (e.g. how much indent is required for a sublist?

From what I read, indents are hard tabs (no 4 spaces). I have noticed this style in many scdoc pages.

Can you include multiple paragraphs under list items, and if so how?

Following the indentation, I suppose:

Here comes a list

- Item 1

  Here is a text describing item 1

- Item 2

  Here is a text describing item 2

  - Subitem 2.1

    Text describing subitem

  Back to item 2 description

- Item 3

@jgm
Copy link
Owner

jgm commented Aug 7, 2024

Following the indentation, I suppose:

Have you tried it, though?

@AndersonTorres
Copy link
Author

AndersonTorres commented Aug 13, 2024

To be honest I did not test this. A truckload of things were in my way this week.
I conjectured it by reading the source codes of a small sample of packages that employed scdoc.

Here is a quick test I did:

testfile.scd
output.3

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

No branches or pull requests

2 participants