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
Revise haddock reader to fit new haddock markup #1346
Comments
See #1135 for relevant comments. |
It has been done but is not going into 2.14.x revisions shipping with GHC 7.8.x. When time comes, we will ship a separate package called haddock-library (name subject to change) which exposes a parser function of type Thinking about it though, I think we could just release We don't offer anything for the writer as we don't have a use case for it. |
It would be great if haddock-library could be released! I understand that this would only help with the reader. |
OK, I'll see whether I can release it today. |
See haddock-library on Hackage . Please let me know if it doesn't do something you'd expect. Tested with 7.6.3, 7.8.{1,2,soontobe3} and HEAD. |
Great! I sent you a small pull request to let it build on 7.4. +++ Mateusz Kowalczyk [Jun 18 14 00:12 ]:
|
The newhaddock branch has a new improved haddock reader based |
I've pushed a new haddock reader and writer to pandoc master. |
That's cool to hear. |
By the way, I ran into a couple of oddities in haddock-library. On the input "one\n\ntwo", parseParas gives
But on the input "1. one\n\n two", it gives
This is strange. I would have expected that the contents of the ordered Another quirk was that DocHeaders appear inside DocParagraphs. e.g.
Is that intentional? |
Yes. Here is how it looks when we put it in a comment:
This falls into the rules for nesting in lists which is a new feature from 2.14.x onwards. It allows one to write things like
If in your example you don't indent ‘two’, you'd get what I think you're saying is the expected behaviour:
I admit that I don't remember why it is but I speculate that it was to ensure proper rendering. It may very well be that this is not necessary, I will investigate. It is possible that there may be some weird behaviour, please don't hesitate to report anything, I can only come up with so many tests. |
I understand that this is an ordered list item with two paragraphs contained in the item. What I don't understand is why it is
and not
That is: shouldn't the contents of the list be a paragraph appended to a paragraph, rather than a paragraph that contains some text appended to another paragraph? |
OK, I see what you mean. We do this on purpose (unexported |
If you do change how it works, please let me know so I can make corresponding changes in pandoc. |
I have found some time to investigate it and as it turns out, both the problems you pointed out were just my brainfarts. I have made changes so that DocHeader is no longer wrapped in DocParagraph and paragraph nesting inside lists is as you were expecting it to be to begin with. Please see version 1.1.0, now on Hackage. In the future please make issues on haskell/haddock GitHub repository, thanks for spotting and reporting. |
Excellent. That helps me simplify some crufty code. |
Haddock uses a new parser, so pandoc's parser, which is based on the old haddock, is out of date.
The haddock library is supposed to factor out and expose the parser, without a GHC dependency, which would enable us to use it directly.
The text was updated successfully, but these errors were encountered: