-
Notifications
You must be signed in to change notification settings - Fork 100
Markdown output #1341
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
base: master
Are you sure you want to change the base?
Markdown output #1341
Conversation
* 'master' of github.com:/ocaml/odoc: (31 commits) Update docs Parser: Ensure parser can be called concurrently Parser: Fixes following PR review Parser: more tests Parser: Allow \ddd escape sequence in code-block metadata Parser: Use lexer for quoted strings in code block metadata Simplify code-block tag types and parser Warn on escaped character that does not need escaping Tag parsing: Unescape everything Make ocamlformat ignore cppo file Fix odoc_of_md wrt new tag type Fix typo Disable extract-code on OCaml < 4.10 Extract code: handle error Add location to the whole tag block Add location to binding key and value Add location for tag/binding Fix unescaping of quoted strings Parse code block tags OCaml 4.14 compatibility ...
src/markdown2/odoc_markdown.cppo.ml
Outdated
@@ -0,0 +1,16 @@ | |||
module Config = Config | |||
|
|||
#if OCAML_VERSION >= (4, 08, 0) |
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 think you mean 4.14 here?
…-cmarkit * 'markdown-output' of github.com:davesnx/odoc: Remove copyright from markdown generation Use cppo to hide Generator from dune build remove 'tree' from cram Install cmarkit on 4.14 Expose Config and Generator
Implement our own markdown rendering
I updated this PR with davesnx#1 without the cmarkit library. I worked on a separate branch to make the review easier. I added an attribution comment, but should other attribution be made on the LICENSE? |
```ocaml | ||
let x = 42 | ||
``` |
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'm not very familiar with source-impl, but I wanted to add the implementation in case was helpful somewhow, would be nice to ensure this is correct
Hi,
This PR might come out of the blue, but there's a good reason. Let me explain myself in the "Why" below.
Also, when I was half done, I discovered a stale PR (#791) targeting the same problem, and I thought it could be helpful to other people.
Why
We use
odoc
in Melange's documentation, to generate API references for Melange libraries, such as Belt, Js, and Stdlib. While the rest of the documentation is handled by vitepress a static site generator working with Markdown files, with a lot of interesting features.This works reasonably well, but creates a big barrier between the documentation sites:
For this reason, I wanted to generate markdown from odoc and (in the melange case) have another process that manipulates those markdown files to expand the documentation.
Another big use case for Markdown generation is Github, or any markdown renderer platform really.
How
I forked the HTML backend into a
markdown2
, removed what's unnecessary, and implemented Markdown construction with cmarkit.I currently name it
markdown2
since there isodoc_md
anddoc_of_md
under the markdown folder. I suggest renamingmarkdown -> odoc-md
(or justmd
) andmarkdown2 -> markdown
in a new PRNotes about implementation
--allow-html
where I enable this functionality of outputting HTMLmarkdown-with-belt.t
andmarkdown.t
). I could probably split them or organise them differently.Example
melange-re/melange-re.github.io#224
Future work
—allow-html
option I mentioned above