Design Rationale:
We need 3 kinds of annotations:
.
indicate a type/class, and generate RDFa typeof
attribute : {.foaf:Person}
=
indicate a URI of a known entity, and generate RDF resource
attribute : {=wdt:Q42}
property
attribute : {foaf:name}
See PHP Markdown extra special attributes and Pandoc's header attributes :
Extract from PHP Markdown extra documentation :
With Markdown Extra, you can set the id and class attribute on certain elements using an attribute block. For instance, put the desired id prefixed by a hash inside curly brackets after the header at the end of the line, like this:
Then you can create links to different parts of the same document like this:
To add a class name, which can be used as a hook for a style sheet, use a dot like this:
You can also add custom attributes having simple values by specifying the attribute name, followed by an equal sign, followed by the value (which cannot contain spaces at this time):
The id, multiple class names, and other custom attributes can be combined by putting them all into the same special attribute block:
At this time, special attribute blocks can be used with
- headers,
- fenced code blocks
- links, and
- images.
The attribute mechanism need to be extended to annotate lists. In this case the curly brackets should be put right before the list:
An attribute without .
, without #
and that is not a key-value pair should be recognized as a property name, e.g. {foaf:name}
.
An attribute beginning with the =
sign indicates a subject URI, equivalent to an about=xxx
property, e.g. {=wdt:Q42}
is equivalent to {about=wdt:Q42}
See PanDoc bracketed spans
Should produce
If the list item contains :
or =
, the annotation is applied to the string after this character. Should final dot or semi-coloon be omitted here ?
Should yield (note how semi-colon is exclused from last annotation) :
Should yield
Should yield
Annotating a list with a property annotation should be treated as if all list items are annotated with the same property
Is equivalent to
And should yield
Should yield
Same with _
, *
or **
.
If a property annotation immediatly follows a word with no explit inline delimiters, it should be applied to this word only. (Is it really possible in termes of parsing ? don't know).
Should yield
It should be possible to annotate with 2 properties
RDFa relies on a mechanism to indicate the current subject of the annotation (precise reference needed). We should aim at having something equivalent in SemanticMarkDown.
Intuitively, the current subject is the resource annotated in the "closest ancestor" of a property annotation.
Use an attribute with a key-pair, with the key "about" or "resource"
Can we find some ind of shortcut ? Maybe use the equal sign
It should be possible to combine an ID and a type attrbute
Used to indicate that a certain inline portion of a sentence is about an entity.
Should yield
Used to indicate that a whole paragraph is about an entity.
Should yield
Used to indicate that a whole list describes an entity
Should yield
For readablity, the list annotation should be seeked at the end of the line preceding the list:
Indented lists are key because they could make plain MarkDown lists look like JSON-LD-like structures;
Annotated version:
Arguably, this is not human-readable anymore
Used to indicate that a blockquote describes an entity
TODO
Used to indicate that a certain section of a document describes an entity.
While this is certainly useful and intuitive to do (and compatible with the attributes MarkDown extension), this is probably the most tricky to implement because a header in MarkDown does not generate a common HTML ancestor for its whole content.
Let's assume for now that it is possible to generate a <div>
that contains the entire header content, but the feasability of this should be checked.
TODO
Should yield
Should yield
Use link references, anywhere in the document, preferably at the end to ease readability.
Should yield
Question : how to distinguish link references that are prefixes from link references that are just link references ? should we need a special annotation for that ? e.g. {@prefix}
:
Meeting with _Bob_{.http://xmlns.com/foaf/0.1/Person}
Meeting with _Bob_{.<http://xmlns.com/foaf/0.1/Person>}
Meeting with _Bob_{.foaf:Person}
Prefixes known in RDFa Core Initial Context
In this example there is a "key : value" syntax we could use to populate correctly an event (instead of [*]). The first "key:value" is Date:10/11/2019, meaning the script has to put 10/11/2019 in date property of event.
If we encounter "Attendees:", we retrieve schema of event's attendee => foaf:Person and we use it to analyse the stuff below.
– Swann
Very readable ! Looks very much like JSON-LD, with a context. Besides, makes link clickable. And does not rely on an extension to capture the property. Closer to original MarkDown philosophy. Lots of advantages !