-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add support for manpages via mandoc #1196
Conversation
Hey @kivikakk - what do you think of this? With some additional polish, would it be considered for merging? |
I'm so grateful this is being considered. Seriously.
It's the same language. Authors don't typically use However, there is enough in-the-wild usage of the As for syntax highlighting, well, you don't have anything to worry about. 😉 .Sh SYNOPSIS
.Nm grep
.Bk -words
.Op Fl A Ar num
.Op Fl C Ns Op Ar num
.Op Fl Fl binary-files Ns = Ns Ar value
.Op Fl Fl color Ns Op = Ns Ar when
For |
There has been another release of |
Yeah, that'd be my doing. Sorry about that. 😜 |
@Alhadis No apologies necessary, especially if the changes mean we can toss the XSLT in the trash ;) |
Yea, that is truth, |
Support for the Changes will become live on GitHub after the next release of Linguist. |
Question: How will However, MathML support is far from universal, with only Firefox having full support. A client-side library like MathJax would therefore be needed to guarantee consistent handling across browsers. This might complicate things unless MathJax is already in use as a production dependency. In any case, Example:Input: .Dt Document title
.Dd 2018-08-20
.Ss SYNOPSIS
.EQ
Z ~=~~ U over V
~~=~~ {a + b X} over {c + d X}
.EN Output: ![]() <math class="eqn">
<mrow><mi>Z</mi><mo>=</mo><mfrac><mi>U</mi><mi>V</mi></mfrac><mo>=</mo><mfrac><mrow><mi>a</mi><mo>+</mo><mi>b</mi><mi>X</mi></mrow><mrow><mi>c</mi><mo>+</mo><mi>d</mi><mi>X</mi></mrow></mfrac></mrow>
</math> |
It is really uncommon and I think this can be postponed after basic support will be there. |
That works for me then. 👍 |
@Alhadis: and file extensions |
I'm not sure. I think so, but care would be needed to expand I may be a little apprehensive because of the widespread misclassification of files using @RalphCorderoy Could you add your thoughts here? |
@Alhadis: about |
Ah, alright. :) That's what I thought, but I didn't want to assert an assumption. Cheers! |
Hi! Any progress on this pull request? It is still marked as WIP and lot of people would love to see support for rendering manpages. |
Seconding this request for a status report. I'd love to start documenting projects with a real formatting language. Forever sick of markdown. |
Hi, I plan to start working again on this on Monday. |
Here's my plan for this:
Please ping me if any of those sound off |
All parts of your plan sound reasonable, let us know how it goes and whether you encounter any issues with mandoc. Two minor remarks:
You probably also want files with the extension "*.n", which is customary for Tcl/Tk library manuals. For example, i have these manual pages on my system: /usr/local/lib/tcl/tcl8.6/man/mann/Tcl.n
Not sure why you mention MathJAX; mandoc does not emit MathJax (or any JavaScript whatsoever). Mandoc merely converts eqn(7) input embedded in manual pages into MathML as defined by HTML5. |
@ischwarze I meant MathML; what I was wondering is if we were already using MathJAX elsewhere on GitHub to solve the cross-browser rendering problems, but it appears that we are unable to do so because it ends up causing problems with some other parts of our frontend. Right now I am considering the following options, with regard to equation support:
|
I think you should really ignore MathML problem right now. Mathematic formulas are not so common in Linux manpages... So the easiest thing is to pass MathML output as is. |
Agreed, just pass it through unaltered. It's Chrome's bloody fault for not bothering to support a published standard. We can worry about fine-tuning later. |
Co-authored-by: Jordan Webb <[email protected]> Co-authored-by: Anthony Riley <[email protected]>
Co-authored-by: Jordan Webb <[email protected]> Co-authored-by: Anthony Riley <[email protected]>
Co-authored-by: Jordan Webb <[email protected]> Co-authored-by: Anthony Riley <[email protected]>
@Alhadis I do not think there would be any internal barrier to getting this merged, if we could get it cleaned up. I definitely won't have time to work on it myself any time soon, though. |
@jordemort: what is needed to be done? @Alhadis already wrote that is willing to finish it. Can we move forward? |
@jordemort Be on the lookout for a @mention from me in the next few days. I'll fork from your branch, so you'll need to merge my changes manually (I could submit a separate PR, if you'd prefer—whichever gets this landed sooner). |
I've tested it. It's working. I can see HTML markup printed to STDOUT by running `bundle exec bin/github-markup /usr/share/man/man1/mandoc.1`. So `test_each_render_has_a_name` can take its cryptic obsession with `name` properties and shove it up its khyber.
Okay, done. That was;
Your move, @jordemort. |
@Alhadis: Some of tests on Travis are failing... |
I wasn't even aware that I could trigger a build re-run by pushing a fork of a PR branch… Anyway, two of those failures are caused by Ruby 2.1.* and Ruby 2.2.* having no support for <<~squiggly heredocs (which I've removed, even though I doubt very much that GitHub are still supporting two EOL versions of Ruby). The other two failures, though… eh, I've got no explanation. The tests are passing perfectly fine when run locally. I can only assume it's environment-related (possibly something to do with an old version of I'll keep testing, though @jordemort may need to throw me a bone here. |
@Alhadis I triggered them, by pushing your commits from your branch to this one - you can also trigger them yourself by opening a new PR and pushing commits to it. I will need to get back to you re: support for older Ruby but it might be fine to drop it? We certainly don't run anything that old internally. It looks to me like the test failures are a side effect of the HTML output of |
We have two major problems here:
IMHO, a more reliable test would involve fuzzy-matching portions of a rendered HTML document. |
@Alhadis Yes, the tests could be fuzzier, or the XSLT could be more complex, or maybe we could just give up on the XSLT altogether and say "I'll accept whatever |
True. The exact format of HTML output is expected to become more stable over time, but some changes will likely happen for quite some time: the HTML output is not yet perfect. I'm a bit confused what you are trying to test here. It can't really be whether mandoc produces the expected HTML output, right? Because you are not testing mandoc here as far as i understand. Besides, whether mandoc produces the expected HTML output is already tested extensively in the mandoc regression suite. That seems the proper place to do such tests. Doing the tests there also implies that they are always done for the right version of mandoc, without doing any version detection, simply because the mandoc regression suite is part of the mandoc repository itself.
In the test suite for some other program, are you considering to provide different test suites (or at least varying tests) depending on the mandoc version? That would seem surprising to me. You want to test the other program, not mandoc, or what am i missing?
That sounds reasonable. The short .Dx example you provided is less likely to change than a larger chunk of output. Alternatively, just looking for the string
might be even more robust. That is very likely to be contained in the HTML output of any version of mandoc for any input document, and it is not likely to change in the future. |
@jordemort i've updated the tests to use Nokogiri's CSS selectors to assert the existence of
We're testing this library's ability to shell out to |
@Alhadis I think at this point you're going to be better off opening your own PR, so you don't have to wait for me to push things to the branch to get the tests to run. Re: "why is this this way / why is this not finished" - this was a project from an internal hack week in 2018. I was not familiar with this codebase at the time; indeed, I barely knew Ruby. I do not have any ownership or authority over this repository, I do not have any time on my schedule allocated to work on it any further, and as far as I know it hasn't made it to anyone else's roadmap either. I would have really liked to see manpage support added to this gem, but I am not the person that is going to be able to make it happen. |
Hi @Alhadis, If you do open your own PR then please state its URL here. Thanks. |
Already on it. You'll all be @cc'd in the new PR. 👍 |
@Alhadis: Do you have some updates? Or do you need some help? |
@pali It's mostly finished; I've written a gem that handles the HTML filtering and refinement (in a manner optimised for display on GitHub). The only things left are regression tests, coverage reporting, and CI. You see, nobody at GitHub is currently maintaining With all that said, I still have no idea what the chances are of getting this PR approved by GitHub. 😕 |
Pinging @lildude to confirm whether he'd be willing to step in as this gem's maintainer/"owner". I've a lot on my plate at the moment, so it makes no sense to continue working on something that's not going to be used anyway… (Note that I'll take care of all the hard work if this gem does get "adopted"… 😉) |
Unfortunately, I don't have the bandwidth right now. I'll keep it in mind for when my load lightens though. |
Nope. No news. I'm not actively involved in this project and don't have the bandwidth to become active. |
Here's to hoping something happens. |
mandoc
is small and simple enough that we decided not to sandbox itIn support of https://github.com/github/enterprise2/pull/14408
cc @anth1y @dctucker