this post was submitted on 24 Jan 2026
89 points (97.8% liked)

No Stupid Questions

45630 readers
1000 users here now

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here. This includes using AI responses and summaries.



Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

founded 2 years ago
MODERATORS
 

I need it for doing CVs and job applications and that's literally it.

you are viewing a single comment's thread
view the rest of the comments
[–] nutsack@lemmy.dbzer0.com 3 points 22 hours ago* (last edited 22 hours ago) (1 children)

I am composing my resume with markdown and then using a python script to produce a PDF. The result is vertical and clean and machine readable:

#!/usr/bin/env python3
"""Convert Markdown files to PDF."""

import argparse
import sys
from pathlib import Path

try:
    import markdown
    from weasyprint import HTML, CSS
except ImportError:
    print("Missing dependencies. Install with:")
    print("  pip install markdown weasyprint")
    sys.exit(1)


CSS_STYLES = """
@page {
    margin: 0.5in 0.6in;
    size: letter;
}
body {
    font-family: "Courier New", Courier, "Liberation Mono", monospace;
    font-size: 10pt;
    line-height: 1.4;
    color: #222;
    max-width: 100%;
}
h1, h2, h3 {
    margin-top: 1em;
    margin-bottom: 0.3em;
    padding-bottom: 0.2em;
}
h1 { font-size: 16pt; }
h2 { font-size: 13pt; }
h3 { font-size: 11pt; }
h4 { font-size: 10pt; font-weight: normal; margin-bottom: 0.5em;}
ul {
    margin: 0.3em 0;
    padding-left: 1.2em;
}
li {
    margin-bottom: 0.2em;
}
p {
    margin: 0.4em 0;
}
p + p {
    margin-top: 0.2em;
}
strong {
    font-weight: bold;
}
"""


PAGE_BREAK_MARKER = "<!-- pagebreak -->"
PAGE_BREAK_HTML = '<div style="page-break-before: always;"></div>'


def process_page_breaks(html_content: str) -> str:
    """Replace page break markers with actual page break HTML."""
    return html_content.replace(PAGE_BREAK_MARKER, PAGE_BREAK_HTML)


def md_to_html(input_path: Path) -> str:
    """Convert a Markdown file to HTML content."""
    md_content = input_path.read_text(encoding="utf-8")
    html_content = markdown.markdown(md_content)
    return process_page_breaks(html_content)


def convert_md_to_pdf(input_paths: list[Path], output_path: Path) -> None:
    """Convert one or more Markdown files to a single PDF."""
    html_parts = []
    for i, input_path in enumerate(input_paths):
        if i > 0:
            html_parts.append(PAGE_BREAK_HTML)
        html_parts.append(md_to_html(input_path))

    full_html = f"""
    <!DOCTYPE html>
    <html>
    <head><meta charset="utf-8"></head>
    <body>{"".join(html_parts)}</body>
    </html>
    """

    HTML(string=full_html).write_pdf(output_path, stylesheets=[CSS(string=CSS_STYLES)])
    print(f"Created: {output_path}")


def main():
    parser = argparse.ArgumentParser(description="Convert Markdown files to PDF")
    parser.add_argument("files", nargs="*", type=Path, help="Markdown files to convert")
    parser.add_argument("-o", "--output", type=Path, help="Output PDF path")
    parser.add_argument("-m", "--merge", action="store_true", help="Merge all input files into a single PDF")
    args = parser.parse_args()

    # Default to all .md files in current directory
    files = args.files if args.files else list(Path(".").glob("*.md"))

    if not files:
        print("No Markdown files found")
        sys.exit(1)

    if args.merge:
        if not args.output:
            print("Error: --output is required when using --merge")
            sys.exit(1)
        for md_file in files:
            if not md_file.exists():
                print(f"File not found: {md_file}")
                sys.exit(1)
        convert_md_to_pdf(files, args.output)
    else:
        if args.output and len(files) > 1:
            print("Error: --output can only be used with a single input file (or use --merge)")
            sys.exit(1)

        for md_file in files:
            if not md_file.exists():
                print(f"File not found: {md_file}")
                continue
            output_path = args.output if args.output else md_file.with_suffix(".pdf")
            convert_md_to_pdf([md_file], output_path)


if __name__ == "__main__":
    main()
[–] mr_pip@discuss.tchncs.de 2 points 9 hours ago (1 children)
[–] nutsack@lemmy.dbzer0.com 1 points 9 hours ago

I could not get pandoc to work on my system. after a few attempts going in circles with dependency packages, I gave up