Markdown

Markdown is a lightweight markup language for writing formatted documents inspired to conventions of web posting. We can interpret a Markdown document as a sequence of blocks (e.g. paragraphs, lists, headings, code blocks). Some blocks (e.g. list items) contain other blocks, whereas others contain inline contents (e.g. links, images etc.). In SPARQL Anything, a document is represented as a list of typed containers. Where the type denotes the kind of block (e.g. heading, paragraph, emphasised text, link, image etc.); lists are needed for specifying the sequence of the blocks. Additional attributes such as the depth of the header or the type of list (bullets, numbers, etc...) can be also supported, relying on the key-value structure.

SPARQL Anything relies on the CommonMark Java implementation of Commons Markdown.

Extensions

SPARQL Anything selects this transformer for the following file extensions:

  • .md

Media types

SPARQL Anything selects this transformer for the following media types:

  • text/markdown
  • text/x-markdown

Default implementation

Default Transformation

Data

# Title
The following list of issues:

- first issue
- second issue

---
Footer paragraph.

Located at https://sparql-anything.cc/examples/simple.csv

Query


CONSTRUCT
  {
    ?s ?p ?o .
  }
WHERE
  { SERVICE <x-sparql-anything:location=https://sparql-anything.cc/examples/simple.md>
      { ?s  ?p  ?o }
  }

Facade-X RDF:

@prefix fx: <http://sparql.xyz/facade-x/ns/> .
@prefix xyz: <http://sparql.xyz/facade-x/data/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

[] a fx:root, xyz:Document ;
 rdf:_1 [
    a xyz:Heading ;
    rdf:_1 "Title"^^xsd:string ;
    xyz:level "1"^^xsd:int
 ] ;
 rdf:_2 [
    a xyz:Paragraph ;
    rdf:_1 "The following list of issues:"^^xsd:string
 ] ;
 rdf:_3 [
    a xyz:BulletList ;
    rdf:_1 [
        a xyz:ListItem ;
        rdf:_1 [
            a xyz:Paragraph ;
            rdf:_1 "first issue"^^xsd:string
        ]
    ] ;
    rdf:_2 [
        a xyz:ListItem ;
        rdf:_1 [
            a xyz:Paragraph ;
            rdf:_1 "second issue"^^xsd:string
        ]
    ]
 ] ;
 rdf:_4 [
    a xyz:ThematicBreak
 ] ;
 rdf:_5 [
     a xyz:Paragraph ;
     rdf:_1 "Footer paragraph."^^xsd:string
  ] .


Options

The Markdown connector does not expose any custom option.