Skip to main content

linkml-renderer

Project description

linkml-renderer

Generating HTML, Markdown, Mermaid, and other rendering artefacts from LinkML data.

This applies a configurable generic mapping between instance data and the target output file. This is an example of a "no code" approach to generating visual representations of data.

In general, writing custom code (e.g. in Jinja) that is specific to your schema may produce more user-friendly results. LinkML-renderer should only be used in cases where it is harder to commit developer resources to writing custom code.

Status: experimental

Command Line Usage

Minimally, you must pass in a schema (LinkML YAML) and a file of instance data conforming to the schema:

linkml-render -s my-schema.yaml my-data.yaml

or with a specific output file:

linkml-render -s my-schema.yaml my-data.yaml -o output.html

The default output type is HTML.

To produce other formats:

linkml-render -s my-schema.yaml -f markdown my-data.yaml -o output.md

You can pass in a configuration file using --config (`-c).

linkml-render -s my-schema.yaml my-data.yaml -c my-config.yaml

The YAML file should conform to the style datamodel Configuration object. (note: autodocumentation for this model will be produced later, for now consult the LinkML file).

Python Usage

When this library matures, the python documentation will be linked from the main LinkML docs.

For now, see the docstrings directly in the source, and the test folder for examples.

See minimal sphinx docs: https://linkml.github.io/linkml-renderer

Output types

  • HTML
  • Markdown
  • Mermaid

Note that the mermaid can be optionally embedded inside the HTML or Markdown.

How it works

The input object is treated as a tree, and nodes in the tree are recursively visited, producing output in the desired format.

For HTML and markdown generation, the following default rules are applied:

  • singular outer objects are translated to Description Lists
  • lists of objects are translated to tables

These rules are contextual:

  • Tables are not nested inside tables

The rules are also configurable. See the style schema and test cases for details.

For example, in the person infoschema, a Container contains a list of persons and a list of organizations. The default rendering will create two tables, with each row representing an individual or organization.

This can lead to wide tables if there are a large number of slots.

If the persons or organizations slot is mapped to RenderType.description_list, then instead, each item gets its own description list, resulting in a longer narrower page.

Limitations and Future plans

Currently there are limits to customizability, both in terms of stylesheets and in terms of how schema elements map to output elements.

The HTML generation is currently hardwired to use Bootstrap.

It is likely that the functionality here may be subsumed into a future linkml.js library. At this time the framework may be extended to include interactive form-based data entry.

The library has not yet been tested on a wide range of data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkml_renderer-0.3.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

linkml_renderer-0.3.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file linkml_renderer-0.3.0.tar.gz.

File metadata

  • Download URL: linkml_renderer-0.3.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for linkml_renderer-0.3.0.tar.gz
Algorithm Hash digest
SHA256 59441022182d1386ef761ad4d055a23cef5707e0070400e2f6860893751c05f8
MD5 b3b11ac6101e357cb4ec8cf5dae8b1fc
BLAKE2b-256 0025c28d114671da73099c998153e4f5b9d7b7366baa4201cdeacc7ce16373d6

See more details on using hashes here.

Provenance

File details

Details for the file linkml_renderer-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linkml_renderer-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b2c0207751c8b5abb814b67fa1ae0f2a4dce80637d56ed770f74a40d4fee614
MD5 237d246ed4875ac3cf75e16a282c31df
BLAKE2b-256 b11ec3f1c119600c0555aaf98152133bc3739b2952557bef8315483c770db9d0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page