markdown
Formatted text written in Markdown, which can be shown as a web page or exported as a PDF.
At a glance
- Stored as: the value itself, written inline wherever it is used.
- Read in parts: by a range of lines.
- Edited by: replacing text (
old/new). - Search: by passage, so full-text and similarity search rank a value by its best passage.
Writing
Write the Markdown source; it is kept exactly as written. It is rendered as GitHub-flavoured Markdown: tables, strikethrough, footnotes and links to headings. Raw HTML in the source is cleaned when it is rendered: only what Markdown itself produces survives, with a few harmless inline tags.
Markdown can also be made from a document by reading its text. create it with
dtype markdown and:
- a pdf or image handle as
source: its text is read, with OCR; - a file handle as
source, or the file itself asfileorbytes_b64: its text is extracted (PDFs, Word, Excel and PowerPoint files, and plain text).
A URL given as source is kept as text, not fetched. To convert the document a URL points at, pass it as
file.
Written as
A JSON string whose schema format is markdown.
Reading
Read it as you read a string: get_content with a line
range, or a query in any search mode. A long Markdown document shown by its handle starts with its
outline, each heading with the line range that reads its section, so you can ask for the section you
need.
To get it as a PDF, render it: create a pdf with opts
{"kind": "render"} and the Markdown text as source.
Querying
As for a string: a field of this type has a full-text index and is split into passages for search by meaning, so every search operator works on it. A scheduled job keeps what it hands its next run as Markdown:
ScheduledJob | state ~~ "invoices already sent" | select id, description, match.text
Every operator is in the HQL reference.
Editing
edit replaces text with old and new, as for a string:
old must occur exactly once unless you set replace_all. The result is a new Markdown value under a new
handle.
Operations
Through the dtypes resource: