Leaflet / Leafdoc

A lightweight NaturalDocs-like LeafletJS-style documentation generator
54 stars 19 forks source link

Formatting is hit or miss... #21

Closed ddproxy closed 4 years ago

ddproxy commented 8 years ago

I'm in the process of transferring all the documentation to leafdocs style for Leaflet.Draw (to encourage documenting changes).

I find that formatting from tables, code blocks, and lists are all hit or miss. Sometimes they generate close enough html or don't pick up the formatting at all.

Example:

I have the following in docs-misc.leafdoc

@namespace CDN's
Several CDN's have Leaflet.Draw available.

| CDN and type   |   URI            |
| -------------- | ---------------- |
| unpkg css| https://unpkg.com/leaflet-draw@0.4.1/dist/leaflet.draw.css |
| unpkg js | https://unpkg.com/leaflet-draw@0.4.1/dist/leaflet.draw.js |
| cdnjs css| https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.css |
| cdnjs js | https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.js |

Obviously expect it to parse into...

CDN's

Several CDN's have Leaflet.Draw available.

CDN and type URI
unpkg css https://unpkg.com/leaflet-draw@0.4.1/dist/leaflet.draw.css
unpkg js https://unpkg.com/leaflet-draw@0.4.1/dist/leaflet.draw.js
cdnjs css https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.css
cdnjs js https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.js

but it formats as

| CDN and type | URI | | -------------- | ---------------- | | cdnjs css| https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.css | | cdnjs js | https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.0/leaflet.draw.js |

Note This may very well be an issue with the marked library but there are no issues attached to that library that fit this issue or issues. I've created a ticket with marked to describe the issue and link back to this ticket as a parent.

ddproxy commented 8 years ago

Seems sensitive to the @0.4.1 - thinks it's a tag... great...

IvanSanchez commented 6 years ago

@ddproxy I rewrote parts of the parser and bumped the marked dependency. Leafdoc now retains more empty lines, which should help with these cases. Can you try again?

trusktr commented 5 years ago

Not sure what your needs are, but I was surprised that the markdown template outputs HTML moreso than markdown.

I needed to have raw markdown, so I opened up template.js and added:

Handlebars.registerHelper('raw', function (str) {
    if (!str) { return; }
    if (str instanceof Array) {
        str = str.join('\n');
    }

    return str;
});

and then use it as

{{{raw comments}}}

That way, I can commit the raw markdown output to my repo, for example, and have GitHub handle the markdown rendering, or similar. Also great for passing output to static engines that take raw markdown input.

IvanSanchez commented 4 years ago

The changes done up to 2.2.1 should help with the formatting. Closing for now.