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

.py to PDF #3

Closed
colevandersWands opened this issue Jul 23, 2021 · 6 comments
Closed

.py to PDF #3

colevandersWands opened this issue Jul 23, 2021 · 6 comments

Comments

@colevandersWands
Copy link
Contributor

any interest in a script to convert .py files to a highlighted code pdf for printing? it would create a new pdf with the same name next to each code file.

@jackdoe
Copy link
Owner

jackdoe commented Jul 23, 2021

idk, in general i dont use syntax highlighting at all (global-font-lock-mode 0), and i teach her without syntax highlighting as well, i dont like how colors make you read in a different way, but maybe other kids will find it beneficial

@colevandersWands
Copy link
Contributor Author

I'd never heard that before, interesting. What don't you like about how it makes you read the code?

Maybe a script with a flag? --font-lock

@jackdoe
Copy link
Owner

jackdoe commented Jul 24, 2021

just the syntax colors have opinions that are not my opinions neither the writer's opinions :)

for example, just read this:

// the code will run twice
bool panic  = true
while (true) {
    panic = !panic;
    if (panic) break;
}
// the code will run twice
bool panic  = true
while (true) {
    panic = !panic;
    if (panic) break;
}

without syntax highlighting it is much clear what is important (at least for me), with highlighting it seems like the keywords are more prominent than panic = !panic

i think its a personal thing, so i dont have super strong opinion about it, i just dont like it, it pulls my attention away somehow

also comments are just code if you dont use highlighting.

@colevandersWands
Copy link
Contributor Author

I see what you mean about the panic = !panic. Just so used to reading colored code I hadn't thought about it. thinking back on it I can remember plenty of times when coloring only changed a few key words and makes everything else look less important.

Now I want to try this in class too - plain text programs

also comments are just code if you dont use highlighting.

🧐 ... 👍

@jackdoe
Copy link
Owner

jackdoe commented Sep 3, 2021

i added extract.py to extract all code snippets in .txt files into the examples/ directory

thanks for the suggestion!

@jackdoe jackdoe closed this as completed Sep 3, 2021
@colevandersWands
Copy link
Contributor Author

This is really neat, simple and effective.

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

No branches or pull requests

2 participants