There are no existing standards that I am aware of for RDF in Markdown, but plenty of possible solutions, including Cristian’s
RDFa works by annotating links and containing elements. It can therefore be implemented in different ways in different markdown dialects.
Link attributes/link types/link flavors are probably the most basic way of handling this, in which the rendered html will include an RDFa edge from the page url to the link.
Here’s a range of syntaxes that I’ve come across
-
[LinkType:: value]
-
(field3:: key)
-
linkType:: [[note 1]]
-
[link](url title target=“_blank”)
-
[link](url){:target="_blank"}
- Kramdown
-
[link](url){target="_blank"}
- Pandoc Pandoc - Pandoc User’s Guide
- GitHub - arve0/markdown-it-attrs: Add classes, identifiers and attributes to your markdown with {} curly brackets, similar to pandoc's header attributes
- How do I set an HTML class attribute in Markdown? - Stack Overflow
- custom attributes in python GitHub - Phuker/markdown_link_attr_modifier: A Python-Markdown extension to modify attributes of all <a> tag links. You can add target="_blank" attribute, control opener and referrer policy by adding related attributes, and add custom attributes.
- GitHub - arobase-che/remark-attr: Remark plugin to add support for custom attributes arobase-che/remark-attr: Remark plugin
- GitHub - javalent/markdown-attributes: Add attributes to elements in Obsidian
-
Semantic Markdown - Annotate your markdown content
- Berlin {.schema:Place}
-
https://jibe-b.github.io/project/smd/
An @atom is §composed of a @nucleus, and @electrons…
I find that the cleanest approach is using shortcut reference links with the multimarkdown syntax, so I can write:
This note refers to [alice] who is a person in my knowledge base
[alice]: http://example.com/people.ttl#Alice rel="http://example.com/ontology#mentions"
And this would generate the triple:
<> <http://example.com/ontology#mentions> <http://example.com/people.ttl#Alice>.
For this approach to be manageable I would still want editor support to autocomplete both predicates and subjects, and to create reference links.
The pandoc notation appears to have a bit more support among renderers and in principle can also be used with reference links
[alice]: http://example.com/people.ttl#Alice {rel="http://example.com/ontology#mentions"}
It also has the advantage that it can be used on other container elements, as in the examples in GitHub - javalent/markdown-attributes: Add attributes to elements in Obsidian
This then allows something like (untested):
Bob {about="http://example.com/people.ttl#Bob"}
- knows [Alice]
[Alice]: http://example.com/people.ttl#Alice {rel="foaf:knows"}
to generate
<http://example.com/people.ttl#Bob> foaf:knows <http://example.com/people.ttl#Alice>.
Markdown is really not designed to include non-human readable content, so all these solutions are still a little awkward.
For a more complete solution, it really does make sense to use HTML editing software that allows adding RDFa and/or web annotations, e.g. https://dokie.li/
Personally, I’ve been using Semantic Mediawiki for several years but I’m still experimenting with alternative solutions https://www.semantic-mediawiki.org
Needless to say, SolidOS does not yet provide support for anything like this, though it eventually it could by switching to a different markdown renderer/enabling a plugin.
P.S. apologies if the formatting of this post still doesn’t work after multiple edits.