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

Indentation interferes with syntax highlighting #275

Open
gaow opened this issue Oct 3, 2019 · 4 comments
Open

Indentation interferes with syntax highlighting #275

gaow opened this issue Oct 3, 2019 · 4 comments

Comments

@gaow
Copy link
Member

gaow commented Oct 3, 2019

I"m using report action to dump some utility functions, see below:

2019-10-03-12-02-30_scrot

Not sure how hard it is but it would be real nice to add some argument in report action to specify syntax highlight type.

@BoPeng
Copy link
Contributor

BoPeng commented Oct 4, 2019

Are we treating them as plain text now? I would strongly suggest against an additional frontend-only parameter. It could be implemented by checking the file extension of output parameter, but this is pretty difficult to do (doable, but we have to drop support for complex cases such as variable and expression), and will not be of high priority.

@gaow
Copy link
Member Author

gaow commented Oct 4, 2019

Are we treating them as plain text now?

Well, rather we treat them as 'comments'. Maybe as plain text would be better that treating them as comments as you can see above.

@BoPeng
Copy link
Contributor

BoPeng commented Oct 4, 2019

It appears to be the way markdown texts are highlighted, related to indentation and comments

image

@BoPeng BoPeng changed the title Syntax highlight in report Indentation interferes with syntax highlighting Oct 4, 2019
@BoPeng
Copy link
Contributor

BoPeng commented Oct 4, 2019

I think the essential problem is that many syntax highlighters are indentation aware. For example, the Python syntax highlighter will work differently if the block of python code indents by 2 or 4, and the markdown highlighter also works this way.

The solution here would be calculating the level of indentation and removing block level indentation before applying the syntax highlighter. I am not sure how it can be done though.

@BoPeng BoPeng transferred this issue from vatlab/sos Nov 21, 2019
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