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

Feature request: Some way of highlighting lines of code within a script #615

Open
fherreazcue opened this issue Oct 18, 2024 · 1 comment

Comments

@fherreazcue
Copy link

It is fairly common in lessons in which a script is being developed that the full script is reproduced on every step.
Sometimes, this makes it a bit hard to follow which are the line that changed in the last step.
It would be useful to be able to highlight one or multiple lines of code within a code block.
For example,

import pandas as pd

file_path="/my/file.csv"

def stats():
  with open(file_path) as f:
    df = pd.read_csv(f)
    df = df.iloc[:, 1:]                 <---- make this line bold, or a different background
    stats = df.describe()
    return stats.to_json()

One option is markdown is to use the diff language, but it does not work with sandpaper. Also, you loose the syntax highlighting.

Potentially useful as a substitute, if this is not possible, would be to allow turning on code line-numbers, so that they can be pointed out.

@froggleston
Copy link
Contributor

Hey @fherreazcue ! As sandpaper is based on basic markdown syntax, I'm not sure this is possible, at least at the moment. It would be good to see if anyone else has any experience!

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