user-documentation
user-documentation copied to clipboard
Line numbers in code snippets
Please complete the information below:
Where is the problem?
Code examples.
-
-
- eg "The section describing how widgets work" - - -
-
What is the problem?
In the code examples, the errors show line numbers but the code itself is shown without line numbers. It would be much clearer if the line numbers were present to identify the source of the errors.
-
-
- eg "It doesn't explain that widgets are singletons" - - -
-
Please don't change anything below this point.
- Build ID: 2019-02-14T15:43:02+0000:295af88d1de39887aa1dab1972d18d2d4a460f14
- Page requested: /hack/types/introduction
- Page requested at: Thu, 07 Mar 2019 14:12:57 +0000
- Controller: GuidePageController
We could probably add that code here: https://github.com/hhvm/user-documentation/blob/main/src/markdown-extensions/PrettyCodeBlocksFilter.php#L45.
Looks like the code string is split by lines into a vec. Maybe we could append a number if the code sample is at least two lines long and then put it back together in the join.
@AndrewDiMola this should probably be done in CSS. We don't want to break copy-and-paste for code snippets.
@AndrewDiMola this should probably be done in CSS. We don't want to break copy-and-paste for code snippets.
Oh, I didn't even think about that. Good point.