-
Notifications
You must be signed in to change notification settings - Fork 155
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
Haddock: Fix very confusing formatting errors #2622
Conversation
Here is another one:
|
There are some more weird one:
|
That one is upstream. It renders the part |
0baf704
to
3fe1c2f
Compare
[edit 2] clash-compiler/clash-prelude/src/Clash/Tutorial.hs Lines 1190 to 1192 in 930641c
[/edit 2] Oh no. That one does not occur when building with GHC 9.0.2, which we use for Hackage doc uploads. It does occur on GHC 9.6.3. I can fix it, that's not the problem. The problem is this: I've often said "the only way to know that your Haddock comes out right is to look at the result carefully and click all links". Apparently that's not enough. Now, when we upgrade to a new Haddock version, we're apparently supposed to carefully reread our entire generated documentation to see if Haddock hasn't changed its interpretation. Undoable.
[edit] We should probably not over-quote those Markdown-style links to prevent it looking like LaTeX. Currently, it's rendered correctly, but they might (by accident?) start rendering it differently in a future version. |
3fe1c2f
to
386c639
Compare
Bundle
doc: Fix very confusing formatting errorThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't run it through haddock, but all the edits look good
clash-prelude/src/Clash/Tutorial.hs
Outdated
@@ -1187,9 +1187,9 @@ BlackBox: | |||
begin | |||
if ~IF~ACTIVEEDGE[Rising][0]~THENrising_edge~ELSEfalling_edge~FI(~ARG[3]) then | |||
if ~ARG[7] ~IF ~ISACTIVEENABLE[4] ~THEN and ~ARG[4] ~ELSE ~FI then | |||
~SYM[2](~SYM[5]) <= ~TOBV[~ARG[9]][~TYP[9]]; | |||
~SYM\[2](~SYM[5]) <= ~TOBV[~ARG[9]][~TYP[9]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of these very precise escapes in problem areas, have considered changing to the bird track style code blocks?
Ie change the whole block from:
@
line 1
...
line n
@
to:
> line 1
> ...
> line n
As I understand it those don't have any parsing for formatting/special characters.
You can't do that for some of the code blocks where you want to have embedded links for functions used. But when you don't need that, like in these blackboxes, it'll be more robust against future edits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I 'unno. It's a large diff, it's busy work, I find the @...@
style more pleasant to look at, and it doesn't solve a fundamental issue. But if you feel strongly, I can change it.
BTW, I did check the whole source for more instances of this issue. And there aren't any more instances. Your grep correctly identified all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'll be more robust against future edits.
I feel somewhat defeated in this area. It feels like putting out a single twig in a forest fire. Haddock is just really hard to write and maintain.
I might write a vim syntax file to colour every special character (according to Haddock) in Haskell comments. That way I'll at least see directly that I need to watch out what I'm writing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel somewhat defeated in this area. It feels like putting out a single twig in a forest fire. Haddock is just really hard to write and maintain.
:(
386c639
to
0b5994b
Compare
instance KnownDomain "System" where | ||
type KnownConf "System" = 'DomainConfiguration "System" 10000 'Rising 'Asynchronous 'Defined 'ActiveHigh | ||
instance KnownDomain 'System' where | ||
type KnownConf 'System' = 'DomainConfiguration 'System' 10000 'Rising 'Asynchronous 'Defined 'ActiveHigh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what we want? It could either refer to the type synonym System
or to the type-level string "System"
, I believe. They are the same thing. So it is either this or
instance KnownDomain \"System\" where
type KnownConf \"System\" = 'DomainConfiguration \"System\" 10000 'Rising 'Asynchronous 'Defined 'ActiveHigh
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed.
0b5994b
to
8c3b343
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably ban @
completely. But that's probably hard to do without doctest
like GHC API use..
If you ban |
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed. (cherry picked from commit cb401b8)
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed. (cherry picked from commit cb401b8) # Conflicts: # clash-ffi/src/Clash/FFI/VPI/Object/Value/Parse.hs # clash-lib/src/Clash/Netlist/Util.hs # clash-lib/src/Clash/Primitives/DSL.hs # clash-prelude/src/Clash/Annotations/TopEntity.hs # clash-prelude/src/Clash/Explicit/Testbench.hs # clash-prelude/src/Clash/Intel/ClockGen.hs # clash-prelude/src/Clash/Tutorial.hs # clash-prelude/src/Clash/Xilinx/ClockGen.hs
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed. (cherry picked from commit cb401b8) Co-authored-by: Peter Lebbing <[email protected]>
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed. (cherry picked from commit cb401b8) Co-authored-by: Peter Lebbing <[email protected]>
Because of mistakes escaping special characters, some documentation showed the operators `$` and `*` where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader. Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in `Clash.Tutorial`. This problem does not occur with GHC 9.0.2 (Haddock 2.25.1), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6. To make such things less problematic, we decided to use bird tracks (lines starting with '> ') for code blocks that are not Haskell code, and only use the '@...@' style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed.
Because of mistakes escaping special characters, some documentation showed the operators
$
and*
where the Functor and Applicative operators were intended. Since they are all very common operators, this can be very confusing to the reader.Additionally, it was discovered that later versions of Haddock start interpreting Markdown-style links in code blocks, breaking the rendering of the primitive blackboxes in
Clash.Tutorial
. This problem does not occur withGHC 9.0.2 (Haddock 2.25.1)GHC 8.10.7 (Haddock 2.24.2), which we use to build the documentation for Hackage. But it does occur with at least GHC 9.6.To make such things less problematic, we decided to use bird tracks (lines starting with
>
) for code blocks that are not Haskell code, and only use the@...@
style of code block for Haskell code. Bird tracks don't use any formatting at all. All code blocks with something other than Haskell code have been converted to bird tracks. Additionally, some escaping issues in Haskell code blocks were fixed when they were noticed.My intention is to upload new 1.8.1 documentation with this fix to Hackage. That's going to require a small amount of creativity, as I don't want to upload the changes of 4ac8481. But that should work out just fine.
[edit]
After this PR was merged, I discovered that I had somehow misinterpreted which version of GHC we use to build the documentation for Hackage. I thought it was 9.0.2, and that is what the commit message for this PR says. But we use an even older one, we build the documentation for Hackage with 8.10.7. This does not really change anything, though.
[/edit]
Still TODO:
Write a changelog entry (see changelog/README.md)Check copyright notices are up to date in edited filesI didn't bother with this.