Live data from Hacker News

MdBook – a command line tool to create books with Markdown

rust-lang.github.io

61–70 of 71 posts

Re: MdBook – a command line tool to create books with Markdown

#61
post #52

Biggest downside of this tool is inability to render PDF or ePub[1]. This is why we recently switched to Quarto[2]. Typst is also a good alternative, already mentioned in other comments. [1] https://github.com/rust-lang/mdBook/issues/815 [2] https://quarto.org/

Pandoc[1] helps to convert markdown to pdf and epub [1] https://pandoc.org/epub.html

I know, Quarto is built on top of Pandoc.

Re: MdBook – a command line tool to create books with Markdown

#62
post #56

Depending on the content, I would recommend AsciiDoc (and not Markdown) to write a book. Markdown might be a good fit for text-only books like fiction, but AsciiDoc has much more useful formattings for structrured documents like technical or scientific books.

https://github.com/daviddrysdale/mdbook-asciidoc

That is a nice way to migrate to AsciiDoc. After the migration happened you can add more advanced syntax provided by AsciiDoc.

Re: MdBook – a command line tool to create books with Markdown

#63
post #48

Earlier quoted context omitted.

Opinions—Hugo or Jekyll for blogs. Yes, that Jekyll! Hugo gives you more rope to shoot yourself in the foot with. MkDocs or Docusaurus for documentation. MdBook is not in the running, IMO, unless it’s radically improved since the last time I checked. And here’s my hot take—most generators have a lot of the same design flaws. Routing is generally a mistake—you should instead design a system where every page has a URL…

Regarding MkDocs there's the great Material for MkDocs [0] for documentation. [0] https://squidfunk.github.io/mkdocs-material/

Definitely. I think people using MkDocs should use Material as their first choice.

Re: MdBook – a command line tool to create books with Markdown

#64
post #58
post #4

While we're on the topic of MD, what's the best system for Markdown-based static blogs these days? With good code highlighting, images, colors, etc.

There are 355 generators on this page, many of which support markdown: https://jamstack.org/generators/

Pandoc, an html template for the headers/footers and optional js, a css and a small shell script is usually enough.

Re: MdBook – a command line tool to create books with Markdown

#65
post #47
post #46

Earlier quoted context omitted.

Typst is great, but really doesn't really serve the primary use case of mdbook which is building documentation websites or digital knowledge gardens that are accessible as a website. If you are typesetting a research paper or writing a technical book for print publication typst is a great solution, but for a lot folks not having web support is an absolute dealbreaker.

Apparently HTML output support is coming for typst. I'm very keen, since to be honest markdown just isn't powerful enough to support a lot of the typesetting I want to do. For example, using markdown you can't put text in boxes, reuse styles, link references to diagrams or sections, number headings, do math, and so on. All of this stuff is crazy useful in typesetting. I love markdown, but its missing too many feature…

It has been coming for a while. But I am looking forward to it. It is the only thing preventing me from using it.

Re: MdBook – a command line tool to create books with Markdown

#66
post #4

While we're on the topic of MD, what's the best system for Markdown-based static blogs these days? With good code highlighting, images, colors, etc.

[flagged]

It's a tool for _books_, not blogs. Blogs have a somewhat different set of requirements.

I actually got a lot of good references from this thread.

Re: MdBook – a command line tool to create books with Markdown

#67
post #9

Earlier quoted context omitted.

+1 for quarto. I love it for my personal website, and I use it on a daily basis to create technical reports for my day job.

Do you have any details on your workflow for reports? I “think” in .mds and the. use a VScode extension that creates to PDF on .md save with a custom/header footer template- works 95% of the time but it’s more brittle than I’d like.

As promised, here is my config setup for all of my quarto scripts. In RStudio, you can simply click the "Render" button on source pane of the script to render a pdf. You can also call `rmarkdown::render("file_path.qmd", output_format = "pdf_document")` to render a PDF.

FWIW, when you click "Render", this is the output command that RStudio shows: `quarto preview FILE.qmd --to pdf --no-watch-inputs --no-browse`

Of course, you will have to remember to properly format tables, omit `&` where possible in tables, figure titles, etc. There are so many nuances, but once you've got them figured out, report generation is very smooth.

    ---
    title: Title
    author: Author Name
    date: today
    date-format: long
    pdf-engine: xelatex
    format:
      pdf:
        number-sections: true
        toc: true
        toc-depth: 3
        mainfont: Roboto  # available fonts are dependent on your machine/environment
        sansfont: Roboto
        include-in-header: 
          text: |
            \usepackage{fancyhdr}
            \usepackage{lastpage}
            \usepackage{float}
            \pagestyle{fancy}
            \fancyhead[L]{\empty}
            \fancyfoot[R]{[Company] Confidential}
            \fancyfoot[C]{\thepage\ of \pageref*{LastPage}}
    ---

    ```{r setup, echo=FALSE, include=FALSE}
    knitr::opts_chunk$set(fig.align = "center",
                          warning = FALSE,
                          echo = FALSE,
                          message = FALSE,
                          dev = "cairo_pdf")
    ```
    
    {{}}
    {{}}
    

Re: MdBook – a command line tool to create books with Markdown

#68
mdBook is my favorite tool for creating on-line docs. I wouldn't use it to create a printed book or a PDF, etc., but quick static documentation in HTML it works quite well. It's simple and robust and just works; and most of the limitations are due to Markdown rather than to mdBook.

If I could wave a wand and extend it in any way I chose, I'd want the ability to implement macros (or the equivalent) a la TeX, so as to automate doing fancier formatting in HTML.

Re: MdBook – a command line tool to create books with Markdown

#69
post #4

While we're on the topic of MD, what's the best system for Markdown-based static blogs these days? With good code highlighting, images, colors, etc.

If you want all the manual control like me, I suggest a build script that runs pandoc on .md files and injects HTML fragments into static templates.

Re: MdBook – a command line tool to create books with Markdown

#70
post #58

Earlier quoted context omitted.

There are 355 generators on this page, many of which support markdown: https://jamstack.org/generators/

Pandoc, an html template for the headers/footers and optional js, a css and a small shell script is usually enough.

Can you generate (and include in a page) a list of files located in a certain directory using Pandoc? A quick look at the docs did not turn up anything, and this is something that's essential for me to create a static website.
Post reply on HN