Tree @master (Download .tar.gz)
Feedmark
Version 0.17. Subject to change in backwards-incompatible ways without notice.
Feedmark is a format for embedding structured data in Markdown files in a way which is both human-readable and machine-extractable. The structured data is intended to be "curational" in nature. Articles in Chrysoberyl, Some Games of Note, and other collections of Cat's Eye Technologies' are written in Feedmark.
Informally, the format says that every h3-level heading in the
Markdown file gives the title of an entity, and may be followed
immediately by the entity's "plaque", which is a bullet list
where every item is in the form "field-name: field-value".
Why Feedmark?
In the same way that a Markdown file is still a readable text file, which is nice, a Feedmark file is still a readable Markdown file, which is still a readable text file, which is nice.
While some structured data formats like YAML are fairly easy to read, many web-based file viewers (such as GitHub, GitLab, Forgejo, klaus, etc.) will automatically format Markdown as HTML, making it that much nicer.
Example Feedmark documents can be found in the eg/ directory,
and in the projects mentioned above.
Implementation
This repository contains a Python 3 program, feedmark, which is a
reference implementation of a processor for the Feedmark format.
To use it, you can clone this repository and run it as bin/feedmark
from the directory of your clone, or you can put the bin directory
on your executable search path, and run it as feedmark anywhere.
Or you can install it using pip:
pip install Feedmark==0.17
(Depending on your needs, you may wish to establish a virtual environment first. How to do this is outside the scope of this document.)
feedmark is currently able to do the following things:
Parse and check Feedmark documents
Loading documents will always check that they are minimally well-formed.
feedmark eg/*.md
You can also check documents against a Feedmark schema, which is simply another Feedmark document, one in which each entry describes a property that entries should have.
feedmark eg/*Sightings*.md --check-against=eg/schema/Llama\ sighting.md
Convert Feedmark documents to various formats
The original use case of this tool was to generate an Atom (née RSS) feed of entries in a document:
feedmark "eg/Recent Llama Sightings.md" --output-atom=feed.xml
python3 -m http.server 7000 &
python3 -m webbrowser http://localhost:7000/feed.xml
It can now also output entries as JSON, indexed by entry, or by property, or by publication date:
feedmark --output-json eg/*.md
feedmark --by-property eg/*.md
feedmark --by-publication-date eg/*.md
...or as Markdown or HTML (using the toc extension, which generates
link anchors on headings compatible with the ones generated by GitHub
and which are now in widespread use).
feedmark --output-markdown eg/*.md
feedmark --output-html eg/*.md
Rewrite documents in-place
Feedmark documents can be rewritten in-place; they will be parsed as Feedmark,
and then written out as Markdown, to the same filename that were read in as
input. Note! This is a destructive operation, and it isrecommended that
the files being processed this way are kept under version control such
as git, as this will easily allow the changes to be reverted if necessary.
feedmark --rewrite-markdown eg/*.md
Interlink documents
Markdown supports "reference-style" links, which are not inline with the text.
feedmark can rewrite reference-style links that match the name of
an entry in a previously-created "refdex", so that they
can be kept current and point to the canonical document in which the
entry exists, since it may exist in multiple, or be moved over time.
feedmark eg/*.md --output-refdex >refdex.json
feedmark --input-refdex=refdex.json --rewrite-markdown eg/*.md
See also
Feedmark is a subset of Markdown, which is something it has in common with Falderal, however it has decidedly different goals.
See TODO.md for planned features and HISTORY.md for a record of features added in past versions.
Commit History
@master
git clone https://git.catseye.tc/Feedmark/
- Refactor: rewrite reference links becomes method on Document. Chris Pressey 7 years ago
- Refactor: extract document/refdex reading to feedmark.loader. Chris Pressey 7 years ago
- yastafoti (yastasoti) doesn't live in this repository anymore. Chris Pressey 7 years ago
- Try to make the README more readable. Chris Pressey 7 years ago
- Note recent developments in HISTORY. Chris Pressey 7 years ago
- Tests pass under Python 3.4 now. Chris Pressey 7 years ago
- Until such time as this is Python 3, it is Python 2. Chris Pressey 7 years ago
- yastafoti understands - to mean 'read the JSON from stdin'. Chris Pressey 7 years ago
- Input is a list of dictionaries with 'url' keys. Chris Pressey 7 years ago
- Write a detailed dictionary of information about each link. Chris Pressey 7 years ago
- Factor archiving out of main, into a helper util: "yastafoti". Chris Pressey 7 years ago
- Make able to dump links that don't occur in a Feedmark section. Chris Pressey 7 years ago
- Note some history so far for version 0.6. Chris Pressey 7 years ago
- markdown ships with toc, which implements this more standardly. Chris Pressey 7 years ago
- Generate id's on all header levels, not just h3's. Chris Pressey 8 years ago
- Merge pull request #5 from catseye/develop-0.5 Chris Pressey (commit: GitHub) 8 years ago
- Final small edits before release of 0.5. Chris Pressey 8 years ago
- Clean up the JSON produced by --output-json option. Chris Pressey 8 years ago
- Extract functionality for making a table of contents from main. Chris Pressey 8 years ago
- Merge pull request #4 from catseye/develop-0.4 Chris Pressey (commit: GitHub) 8 years ago
- Small edit to HISTORY. Chris Pressey 8 years ago
- Small edits. Chris Pressey 8 years ago
- Prep for release of 0.4. Chris Pressey 8 years ago
- Add HISTORY document. Chris Pressey 8 years ago
- Format document preamble like section body: one big string. Chris Pressey 8 years ago
- Also remove double-quotes when making anchor ids for h3's. Chris Pressey 8 years ago
- Bestow anchor ids on h3 elements with Markdown extension; faster! Chris Pressey 8 years ago
- Encode URLs as UTF-8 before urlencoding them. Chris Pressey 8 years ago
- Add --archive-missing-only option. Chris Pressey 8 years ago
- Check that local files exist under --article-root when archiving. Chris Pressey 8 years ago