Add line-numbers when wrapping is needed for printing#2431
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2431 +/- ##
=======================================
Coverage 48.92% 48.92%
=======================================
Files 124 124
Lines 5245 5245
Branches 1110 1110
=======================================
Hits 2566 2566
Misses 2371 2371
Partials 308 308 ☔ View full report in Codecov by Sentry. |
|
@Tim-Siu It seems like once you trigger printing then the CSS remains thus the line numbers. In my opinion, it is not easy to undo it. (Prob hacky to undo it). What do you think? If it is too hard and not worthwhile, maybe can ask damith what he thinks about this side effect. Do add documentation. (Also this side effect if we are going with this) |
Sorry I overlooked the bug. It should be fine now. I will write the documentation for this new property right now. |
|
Currently, we don't have existing documentation for printing optimisation. Should we add such a section under reference? |
|
@Tim-Siu |
|
I have added a I will raise a dedicated PR to add a |
* enable markdown formating for content in annotate point * add slot for header and label in annotation point * add documentation on using markdown in content label and header * add functional test * add test cases for annotation
There is no checking of proposed commit message presence. PR authors may forget to include proposed commit message. Adding a check using GitHub Actions will help remind and ensure that authors don't miss out on filling in the commit message. Let's add a job to the a new workflow, pr-message-reminder.yml file to help automate checking and reminding of filling in the proposed commit message for each PR. This approach automates the process, without having to have other users check and remind PR authors themselves. Adding the new job to a new workflow will allow greater control of job triggers while maintaining clean code.
Hi @Tim-Siu, I think there is already an section dedicated to printing in the user guide! Although it is very small... |
|
Sure! I have added a brief overview of other printing optimisations at that section. |
|
Hi @Tim-Siu thanks for the work so far! One thing I noticed was when I tried to print, there seems to be a new line Example: <tag>
<diafsdfjnsdkjfnsdkjfskjdfnksjdfnkdfjsdkjfnsdjfksdfjksndfkjsndkfjnsdkjfnksjdnfkjsndfkjsndfknsdjkfnksjdfnkjsdnfjksdfknsdfkjsndf>
</diafsdfjnsdkjfnsdkjfskjdfnksjdfnkdfjsdkjfnsdjfksdfjksndfkjsndkfjnsdkjfnksjdnfkjsndfkjsndfknsdjkfnksjdfnkjsdnfjksdfknsdfkjsndf>
</tag>Could you take a look to see what is causing the issue and see if there is a fix for it? |
That's a great catch! Sorry for the overlook. I will look into this. |
HI @yucheng11122017 , |
| ##### Printing optimization | ||
|
|
||
| Markbind automatically enhances the readability of your code blocks when printing: | ||
| - **Light theme for clarity**: Ensures optimal contrast by switching code blocks to the light theme when printing. |
There was a problem hiding this comment.
Hi @Tim-Siu, where did you see this? Because the printing still seems to be in dark theme if the code is in dark theme

There was a problem hiding this comment.
Hi @yucheng11122017
It does work like that on my side. But indeed this seems to be undefined behaviors. I will look into this. I will set the PR to draft for now until I thoroughly understand the CSS for the site. Sorry for the overlook.
There was a problem hiding this comment.
Hi no worries @Tim-Siu! I think for now, this PR can just focus on adding the line numbers, which is what you already did. You can just clean up the documentation to not include these undefined behaviors first, add an issue, and then fix it in the future if you are interested!
|
HI @yucheng11122017 , The code block should now be of a light theme. However, I realized that line highlighting (on both the master and this branch) doesn't seem to work. I am not sure if this is the problem of my system or the code. |
| height: 100%; | ||
| } | ||
|
|
||
| /* CSS from codeblock-light.min.css */ |
There was a problem hiding this comment.
Rather than copying the CSS, it might be better to add the class name to the code block? What do you think
|
Hi @yucheng11122017 , |
Utilise content reuse for the documentation Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
|
Hi @Tim-Siu i think there is some issues with the relative file path! sorry i didn't try it out - i just wrote out the idea |
Understood! It should be working now. Thank you for your patience. |
|
@Tim-Siu hmm the check still seems to be failing |
The Netify test seems to be passing on my side. Are there any additional tests that I have overlooked? |
yucheng11122017
left a comment
There was a problem hiding this comment.
Sorry I think I saw the old check run!
LGTM thank you for the work :)




What is the purpose of this pull request?
Overview of changes:
Make code wrapping the default behavior for printing. Add line numbers when wrapping does happen.
Related PR: #2413
Related Issue: #2404
Anything you'd like to highlight/discuss:
Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Automatically enforce soft-wrapping and add line-numbers when code is cut off
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):