Skip to content
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

markdown generator #791

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

markdown generator #791

wants to merge 38 commits into from

Conversation

lubegasimon
Copy link
Collaborator

@lubegasimon lubegasimon commented Nov 29, 2021

Todo:

  • Remove redundant h6 level after the last variant of a constructor. Also the
    spacing between h6 and items is not neat.
    ######             type days  = 
    
    ######               | Mon  
    
    first day of the week.
    
    ######               | Tue  
    
    Second day of the week.
    
    ######       (** This is the bug! *)
  • Entity and Rawmarkup branches for Inline.t are not yet handled in inline function.

Help needed!

  • Reasonably use a single back tick and double back ticks for code spanning.
    In cases where source code contains ‘`’, we want to wrap the content in double back ticks,
    other wise, wrap the content in single back ticks.

  • at-tag keys and definitions should not be rendered on separate lines (This is one one the properties of blocks,
    that is, blocks must be separated by an empty line). That is,

@author : 

John Doe

should be rendered as @author : John Doe.

The unwanted behaviour is because the definition of the at-tag is type blocks
John Doe, where as @author : is inlines, as a consequence, if anything
is to be combined to the definition, it must be blocks.
(I don’t think there is a workaround for this, but I will be happy to see how it can be improved)

  • There are unwanted spaces rendered between some inlines. For example
    module Bar : sig ... end should instead be module Bar : sig … end.
    For clarity, in the output, there are two spaces between module and Bar, two spaces
    between Bar and :, and three spaces after end. I think I’m wrongly treating the output
    of the document library.
    If someone is ready to take on this, I will be happy to see it improved. However, I advise to do
    this after the next list item.

  • The use of join and item_prop isn't nice , it should perhaps be heading instead

  • Entirely get rid of join (iff there is a better alternative to combine inlines).

@lubegasimon lubegasimon marked this pull request as draft November 29, 2021 14:25
@lubegasimon lubegasimon mentioned this pull request Dec 1, 2021
7 tasks
@lubegasimon lubegasimon changed the title Rework markdown generator markdown generator Dec 1, 2021
@lubegasimon
Copy link
Collaborator Author

lubegasimon commented Dec 19, 2021

After some offline discussion previously with @Julow, we agreed to drop the concept of adding back ticks to everything that appears as OCaml code as that would cause cluttering of the markdown output, thus making it unreadable and leading to unexpected poor rendering. In that case, we decided to let OCaml code be formatted using the h6 level.

For example;

module type Foo = sig
  type foo
end

would be formatted as (without backpacks) —

  ######       module type Foo = sig
  
  ######           type foo
  
  ######       end

and the preview is —
Screenshot 2021-12-19 at 15 21 43

whereas, it would be formatted as (with back ticks) —

  ######       `module type Foo = sig`
  
  ######           `type foo`
  
  ######       `end`

and the preview for that is —
Screenshot 2021-12-19 at 15 24 11

Signed-off-by: lubegasimon <[email protected]>
Signed-off-by: lubegasimon <[email protected]>
Signed-off-by: lubegasimon <[email protected]>
@lubegasimon lubegasimon marked this pull request as ready for review December 19, 2021 12:59
Signed-off-by: lubegasimon <[email protected]>
@lubegasimon
Copy link
Collaborator Author

lubegasimon commented Jan 5, 2022

‘ocam-ci' is failing because of \ in OCaml’s nbsp and I am not sure how to escape it.

This changed upstream and is broken since a rebase.
- Use an incrementing integer for better control
- Avoid putting a normal space between each nbsps
Avoid adding headings for bits of code like '}' or 'end'.
We keep the inlining code for now, as it is partially used for other
purposes (variants, records) and in case we'd want to add it back.
Handle the InternalLink case correctly.
Noops shouldn't be present in the tree to respect the contract:

    noop ++ x = x ++ noop = x

Remove the special handling of Text nodes that was a work around this.
This is not a requirement but helps when inspecting the document.
Julow and others added 8 commits February 11, 2022 17:48
@EmileTrotignon
Copy link
Collaborator

This looks like a big PR, and should probably not be part of 2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants