Haddock changes pushed upstream

Hi all,
As some of you might know, I hacked on Haddock over summer as part of
GSOC. After some tedious fighting with GHC validation process and help
of the guys on ghc-devs, the changes were finally pushed upstream couple
of hours ago. While I'm waiting for the maintainer to make a call on the
official release, you can already get the changes if you compile GHC HEAD.
For those not so eager about compiling HEAD, 7.8 should be coming out
the changes will be in that. You can read the brief changelog at [1] and
the updated documentation at [2].
We were careful to not make changes to any existing syntax that would
result in a large amount of packages breaking. If you're a package
maintainer, here are some things to consider:
* If your documentation looks fine how it is now, you're probably fine.
Read the changelog[1] as it mentions some issues that were fixed.
Amongst others, Haddock will now link qualified function names properly
so that's something to look out for.
* none of your documentation should get parse failures: any
previously-failing documentation should now be displayed. This means
that if you have parse failures, now is the time to go and fix them up
or your documentation probably won't look pretty. On an upside, this
means that we won't have whole Hackage packages missing documentation
due to a minor mistake in one of the comments.
* You no longer need to break up lists of the same type with newlines.
Previously you'd get two lists merged on a single line in an incoherent
mess. Now it'll be rendered properly. I know that even GHC documentation
is guilty of this mistake.
* You can now escape the markup properly. Before, you were very limited
on how the markup could be escaped. For example, <
some code example hello
== Heading level two * Hello Haddock! ``` Up to 6 ‘=’s are currently supported. LaTeX back-end only honours up to three ‘=’s but it is not an error to have >3, they'll simply be treated as 3. * You can now display enabled module extensions in the generated documentation with {-# OPTIONS_HADDOCK show-extensions #-}. * Picture syntax now documented. * You can now have the title attribute for your hyperlinks. The syntax is <link title> I think that about covers it all. Perhaps I will write a more visual guide to the new changes but please don't hold your breath! Feel free to ask questions. If you have bugs to report or features to ask for, please head to the Haddock Trac[3]. [1]: http://www.haskell.org/haddock/CHANGES.txt [2]: http://www.haskell.org/haddock/doc/html/ [3]: http://trac.haskell.org/haddock -- Mateusz K.

Oops, something else I forgot to mention. You can now nest markup properly. For example, before it was incorrect to have other markup inside of emphasis. This even meant that the HTML escape codes (which we convert ourselves) would not be converted or that you can't have structures like /@foo@/ as you'd end up with ‘@foo@’ verbatim rather than emphasised, monospaced ‘foo’. This is now fixed. I see this kind of documentation a lot on Hackage so you might want to go and either change it if you're relying on the broken behaviour or leave it as it is and bask in its new glory. More reading at [1]. Thanks [1]: http://trac.haskell.org/haddock/ticket/252 -- Mateusz K.

On 01/12/2014 08:37 PM, Mateusz Kowalczyk wrote:
* You can now nest paragraphs inside of lists. For most people this simply means that you can now have multiple levels of lists. We allow arbitrary nesting depth. The rules are: 4 spaces of indentation, new paragraphs have to be preceded by an empty line.
...
* You can now have headings inside of your documentation rather than only for splitting up sections of your module. Example usage:
Awwwwwwwwwwwwww yiss. This is wonderful. Thank you.

2014/1/13 Mateusz Kowalczyk
[...] * none of your documentation should get parse failures: any previously-failing documentation should now be displayed. [...]
Do we still get warnings or is there a command line flag to get errors back? I definitely don't want to browse through dozens of HTML pages to check if they look OK. For developing purposes I want as many errors I can get. (well, almost ;-)

On 13/01/14 08:58, Sven Panne wrote:
2014/1/13 Mateusz Kowalczyk
: [...] * none of your documentation should get parse failures: any previously-failing documentation should now be displayed. [...]
Do we still get warnings or is there a command line flag to get errors back? I definitely don't want to browse through dozens of HTML pages to check if they look OK. For developing purposes I want as many errors I can get. (well, almost ;-) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
No there is no way to get warnings or errors because it no longer makes sense to do so. The reason for failures in the past was due to Haddock's shortcomings rather than user failures: if your docs failed to parse, you probably tried escaping something where it didn't expect it &c. Ideally, it should have never had parse failures in the past but the parser had many short-comings. It's very hard to give warnings because we can't tell what the user actually wanted to do, only whether they have input valid markup or not. The only change is that now all markup should check out as valid. If your docs look OK now, they will almost certainly look OK with the new version. If they are broken now, they might look terrible in the new version BUT if they are broken now, it's very easy to tell as you'll be getting parse failures. I suggest that if you have any broken documentation right now, go and fix it. If you don't, great, you should be set. Note that even the old/current version of Haddock would never present you with any warnings: it would either error or not. I did start to write a tool which would look at your existing documentation and try to point out any changes between the versions that might affect you but I did not have the time to finish it and it would be very naive even if I did. You can find it at [1] but it does close to nothing. All in all you should be safe. The new markup rules are a lot more intuitive than the old ones and we have not changed anything that would greatly change existing, well-formed documentation. I don't think there is any documentation that will start to look worse except for few edge cases, such as people relying on Haddock not being able to nest markup to put in some other markup symbols verbatim into their text. You can now nest markup so that might end up looking slightly differently. Nothing major. John MacFarlane suggested that I create a sort of dingus which would allow people to input some Haddock markup and be able to see the output from various versions. I think it'd be a useful tool not only for migration but for daily use. I did not have the time to start it but it's certainly in my plans. I'm starting to sit my mid-terms from tomorrow until the end of the month but I might be able to code something up after that. If someone is interested in doing this themselves, let me know so we don't duplicate efforts. [1]: http://hackage.haskell.org/package/doccheck -- Mateusz K.

Thank you for your great work on haddock. We all appreciate it and look forward to your other works in progress. On Monday, January 13, 2014, Mateusz Kowalczyk wrote:
On 13/01/14 08:58, Sven Panne wrote:
2014/1/13 Mateusz Kowalczyk
javascript:;>: [...] * none of your documentation should get parse failures: any previously-failing documentation should now be displayed. [...]
Do we still get warnings or is there a command line flag to get errors back? I definitely don't want to browse through dozens of HTML pages to check if they look OK. For developing purposes I want as many errors I can get. (well, almost ;-) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe
No there is no way to get warnings or errors because it no longer makes sense to do so. The reason for failures in the past was due to Haddock's shortcomings rather than user failures: if your docs failed to parse, you probably tried escaping something where it didn't expect it &c. Ideally, it should have never had parse failures in the past but the parser had many short-comings. It's very hard to give warnings because we can't tell what the user actually wanted to do, only whether they have input valid markup or not. The only change is that now all markup should check out as valid.
If your docs look OK now, they will almost certainly look OK with the new version. If they are broken now, they might look terrible in the new version BUT if they are broken now, it's very easy to tell as you'll be getting parse failures.
I suggest that if you have any broken documentation right now, go and fix it. If you don't, great, you should be set. Note that even the old/current version of Haddock would never present you with any warnings: it would either error or not.
I did start to write a tool which would look at your existing documentation and try to point out any changes between the versions that might affect you but I did not have the time to finish it and it would be very naive even if I did. You can find it at [1] but it does close to nothing.
All in all you should be safe. The new markup rules are a lot more intuitive than the old ones and we have not changed anything that would greatly change existing, well-formed documentation. I don't think there is any documentation that will start to look worse except for few edge cases, such as people relying on Haddock not being able to nest markup to put in some other markup symbols verbatim into their text. You can now nest markup so that might end up looking slightly differently. Nothing major.
John MacFarlane suggested that I create a sort of dingus which would allow people to input some Haddock markup and be able to see the output from various versions. I think it'd be a useful tool not only for migration but for daily use. I did not have the time to start it but it's certainly in my plans. I'm starting to sit my mid-terms from tomorrow until the end of the month but I might be able to code something up after that. If someone is interested in doing this themselves, let me know so we don't duplicate efforts.
[1]: http://hackage.haskell.org/package/doccheck
-- Mateusz K. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe

On Sun, Jan 12, 2014 at 5:37 PM, Mateusz Kowalczyk
* Bold markup added. The syntax is two underscores around what you want bold. Note, we still do not support multi-line markup. It's possible but it's a design choice not to support it.
This is all great, but I have a concern about this one. Do we really need more than one kind of emphasis? Actually, mostly what I don't like is the / markup, because slashes are common, e.g. URLs and paths, and it's a pain to escape them all the time. Messed up formatting due to forgetting a backslash is very common in my docs, and I've even seen it in GHC docs as well. I would prefer to swap /s for *s because *s seem less common, but of course that would break stuff. And I'm sure there are people out there who like using /s for emphasis, so we don't need to repaint that bikeshed. But at least we can avoid adding even more special characters you need to remember to escape. And bold emphasis seems like it's redundant with italics emphasis.

On 27/01/14 04:59, Evan Laforge wrote:
On Sun, Jan 12, 2014 at 5:37 PM, Mateusz Kowalczyk
wrote: * Bold markup added. The syntax is two underscores around what you want bold. Note, we still do not support multi-line markup. It's possible but it's a design choice not to support it.
This is all great, but I have a concern about this one. Do we really need more than one kind of emphasis?
Actually, mostly what I don't like is the / markup, because slashes are common, e.g. URLs and paths, and it's a pain to escape them all the time. Messed up formatting due to forgetting a backslash is very common in my docs, and I've even seen it in GHC docs as well.
This is an existing markup and we won't change it because every piece of documentation using it will break. I have seen plenty of documentation with ugly markup because someone forgot to escape something but it is unavoidable. I agree that ‘/’ might not be the best character but it's as good as any other for this purpose. If it was something else, people would complain about that instead.
I would prefer to swap /s for *s because *s seem less common, but of course that would break stuff. And I'm sure there are people out there who like using /s for emphasis, so we don't need to repaint that bikeshed. But at least we can avoid adding even more special characters you need to remember to escape.
If it was ‘*’ then we'd have to remember that instead (and ‘*’ is also a very common character). The reason I picked two underscores for bold is precisely because it's not that common.
And bold emphasis seems like it's redundant with italics emphasis.
You're free to not use it. A lot of people wanted bold (including myself). It looks different, it's a different kind of emphasis, why not include it? I don't understand your point of view on this. Are you not against different kinds of lists? I mean, all of them enumerate things so why bother with 3 different kinds, right? It is also now a bit late for this post, documentation and tests have been written and it's all done and dusted, just waiting for the imminent 7.8 release. There was plenty of time for input. If you have a pressing reason why bold shouldn't be included, file a Haddock ticket. -- Mateusz K.

On Sun, Jan 26, 2014 at 9:10 PM, Mateusz Kowalczyk
You're free to not use it. A lot of people wanted bold (including myself). It looks different, it's a different kind of emphasis, why not include it? I don't understand your point of view on this. Are you not against different kinds of lists? I mean, all of them enumerate things so why bother with 3 different kinds, right?
Well, every bit of markup added is permanent, and it's one more thing to remember to escape. Redundant kinds of lists aren't so bad because they're not taking up a whole character, but yes if it were just me I would only have one kind of list. Anyway, I missed that it's double underscore, not *s. In that case, it won't be a burden so I'm not worried. Concern withdrawn!

On 27/01/14 05:24, Evan Laforge wrote:
On Sun, Jan 26, 2014 at 9:10 PM, Mateusz Kowalczyk
wrote: You're free to not use it. A lot of people wanted bold (including myself). It looks different, it's a different kind of emphasis, why not include it? I don't understand your point of view on this. Are you not against different kinds of lists? I mean, all of them enumerate things so why bother with 3 different kinds, right?
Well, every bit of markup added is permanent, and it's one more thing to remember to escape. Redundant kinds of lists aren't so bad because they're not taking up a whole character, but yes if it were just me I would only have one kind of list. Anyway, I missed that it's double underscore, not *s. In that case, it won't be a burden so I'm not worried. Concern withdrawn!
Oh, great. You actually reminded me the real reason why ‘*’ is not bold: we already use ‘*’ for unordered lists and it'd be impossible to tell which one you want at the beginning of a paragraph. -- Mateusz K.
participants (5)
-
Carter Schonwald
-
Evan Laforge
-
Mateusz Kowalczyk
-
Michael Orlitzky
-
Sven Panne