Stirling-Tools/Stirling-PDF

[Feature Request]: Markdown to PDf for code blocks

Open

#4 022 ouverte le 22 juil. 2025

Voir sur GitHub
 (1 commentaire) (2 réactions) (1 assigné)TypeScript (6 899 forks)batch import
enhancementhacktoberfest

Métriques du dépôt

Stars
 (78 754 stars)
Métriques de merge PR
 (Merge moyen 3j 21h) (209 PRs mergées en 30 j)

Description

Feature Description

First of all, thank you for the amazing projects and loads of features for PDFs. Its amazing how these features are all open sourced and works llke a charm.

I would like to request a feature to format the code blocks properly. Also, aplogoies if this issue already exists or in the roadmap but I cannot find it anywhere mentioned.

Basically, when I have a code block in my MD file added into three backticks, I can read the MD file in my editors and preview is fine but when I use Markdown to PDF, everything works as expected but the code bloks new lines are removed and becomes a paragraph.

Here is the MD sample:


Test 1

This is a paragraph

Test 2

This is a second paragraph under two hash

Test 3

This is last paragraph to test code block

<script>
    console.log("Page is loaded");
    alert("Welcome to my world!");
<script>

And please find the PDF attachment from the program. test.pdf

Why is this feature valuable?

To be able to format the code block with new lines properly to read the codeblocks in PDF.

Suggested Implementation

Not too sure about this and how complicated it might be under the hood, basic requirement will be parsing the "\n" or converting it into <br> html tag if what its used. It might be too much but if possible, may be colorized the code block too like JS library Highlight.js does.

Additional Information

No response

No Duplicate of the Feature

  • I have verified that there are no existing features requests similar to my request.

Guide contributeur