2

Most markdown libraries convert a markdown string to a html-string oder binary (pdf, tex).

Is there a markdown library which returns a object? I need this to create a Table of Contents, edit single section (like edit section) or section transclusion (like Labeled Section Transclusion.

Example

# MyHead
Some Text
* list one 
* list two
sea takimata sanctus
## Deeper Head
At vero eos
# other Head
lorem ipsum
# MyHead
sea takimata

should return something like this:

{
    "MyHead_1": {
        "Heading_1": "MyHead",
        "Paragraph_1": "Some Text",
        "List_1": ["list one", "list two"],
        "Deeper_Head_1": {
            "Heading_2": "Deeper Head",
            "Paragraph_1": "At vero eos"
        }
    },
    "other Head_1": {
        "Heading_1": "other Head",
        "Paragraph_1": "lorem ipsum"
    },
    "MyHead_2": {
        "Heading_1": "MyHead",
        "Paragraph_1": "sea takimata"
    }
}
  • 2
    HTML-like? Isn't that rather JSON-like? – Izzy Jan 19 '17 at 22:44
  • A JSON string that represents the HTML? Although the HTML-snippet is already arguably an object (DOM)? – MrWhite Jan 19 '17 at 23:06
  • 1
    @Izzy html-like was missleading. I just want to got an object back, no matter the format. – klml Jan 20 '17 at 9:49
  • @w3d yes html is an object, this is god for rg the toc. But I want the markdown as object.( e.g. for section transclusion) – klml Jan 20 '17 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.