Giter Club home page Giter Club logo

md2mld's Introduction

md2mld: Convert md files into odoc mld files

md2mld converts a Markdown-format file into the mld format used by odoc to render HTML documentation or OCaml libraries. You can use this script to automatically embed a README.md file into API documentation for an OCaml library.

Usage

You can use it manually as follows

$ md2mld filename.md > outfile.mld

In dune you can use it to generate an mld file with

(rule
 (target outfile.mld)
 (deps filename.md)
 (action
  (with-stdout-to outfile.mld (run md2mld filename.md))))

Attach the mld file using the (documentation โ€ฆ) stanza. You can see the documentation generated from the latest tagged version of this README at mseri.github.io/md2mld/md2mld.

Known issues

  • Until the new odoc fixing #141 is released, the minimal header allowed in the md file will be the level 3 one ###. You can work around this by using the -min-header 3 flag during the invocation of md2mld.

  • If you see an error like '{0': heading level should be lower than top heading level '0', this is because in ocamldoc the first header must have a level higher than all other headings in the page. You can safely ignore it or increase the level of the subsequent headings to get rid of it.

md2mld's People

Contributors

dmbaturin avatar misterda avatar mseri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

md2mld's Issues

Missing escaping of brackets

md2mld (version 0.3.0 from OPAM) does not seem to escape brackets from Markdown. If I take the file:

Here is some text [...] and then some more.

Here is a bracket: [

Here is a closing bracket: ]

I get an identical .mld file. If I then give this file to odoc, it complains and produces an HTML like the following:

image

where the brackets have been interpreted as code. It should look like the following in Markdown:

image

md2mld is overzealous in its escaping of parentheses

It seems to me that md2mld escapes parentheses in Markdown files, resulting in the escaping character \ showing up in the HTML. If I take a .md file:

This is an (uninteresting) sentence with (useless) parentheses.

and run md2mld (version 0.3.0 from OPAM) on it, I get:

This is an \(uninteresting\) sentence with \(useless\) parentheses.

and compiling such a file with odoc results in the \( and \) showing up in the HTML. Maybe this has to do with escaping (* and *)? But then it's a bit overzealous.

Support for blockquotes

Hey there,

Thank you very much for this tool; very handy!

Would it be possible to add support for Markdown's blockquotes? Currently, I think md2mld doesn't do much with them, which leads to remaining > characters in the output HTML file (as processed with odoc). I am not sure if there is such a thing as blockquotes in MLD files, but then maybe at least remove the > files?

I don't have the time right now but I could try working on a PR adding this in a few months, if you wanted.


Example blockquotes:

Here comes a quote:

> Here is the quote.

Here comes another quote with a nested quote:

> Here is the quote.
> 
> > Here is the nested quote.

Bye!

which shows as follows, on GitHub:

Here comes a quote:

Here is the quote.

Here comes another quote with a nested quote:

Here is the quote.

Here is the nested quote.

Bye!

Add support for mld syntax

Add a way to inject mld syntax, for example to automatically add the correct links to modules or types.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.