Ann
Ann

Reputation: 206

how can I parse json-ld to markdown

Is there an existing parser to parse json-ld to markdown? I want to generate documentation from my jsonld file. If such a thing doesn't exist, how should I go ahead writing one? or perhaps I could use a json to markdown converter? Any suggestions on how could do this?

Upvotes: 4

Views: 449

Answers (1)

Anatoly Scherbakov
Anatoly Scherbakov

Reputation: 1762

I was just googling for such a program, and found your question.

The closest things I could find are: ocxmd, which is an extension to Markdown; and md-ld, which does not even use proper Markdown - instead, it apparently creates an incompatible version of the format which can be parsed to JSON-LD.

If I were writing such a converter in Python, I would use:

  • pyld to parse JSON-LD files and expand them using the @context;
  • And a template engine, likely Jinja2, to generate Markdown representation of every node of the JSON-LD document.

The program would be based on recursion. You might have separate functions to display:

  • URIs,
  • Numbers,
  • Images,
  • ...

The program will recurse over the JSON-LD document and convert each of its sections into Markdown format.

Upvotes: 2

Related Questions