Markdown Woes: Colons

Influenced by all the forum talk of the advantages of Markdown, I’m giving it a whirl, but some things seem so much more difficult, at least now, for the flow of writing. I’m sure I’ll have more questions, but in the meantime, I’m seeing that using the simple colon causes my text to change color, so I’m assuming it’s used for other purposes. How does one write a simple colon? e.g. “Type: Markdown” I looked at a few webpages but still not clear.

Also, from the help, I’m not clear on how to create metadata headers:

Metadata: One of the features of MultiMarkdown is metadata headers. These allow you to add non-displaying information about the document, like authors, dates, and even linked stylesheets. To use the feature, format the first line of the document with a colon, e.g., Author: DEVONtechnologies. This must be the first line of the document. Other metadata fields you wish to add must follow immediately after this first line.

However, if you would like the first line of your document to contain a colon, perhaps adding notes like Developer: A. Edwards and Re: OCR, just add a single blank line at the top of the document and the subsequent lines will be treated as normal paragraphs.

Just write

MyKey: MyValue
AnotherKey: AnotherValue

First line of normal Text. 

A colon in the first line creates Metadata, see above.

If you want to use a colon in the first line but don’t want to create Metadata you need to escape it, like so \:

Or just don’t use the first line:

I’ll add one example to @pete31’s comprehensive and helpful response. Just try adding, on a separate, first line of a markdown document:

tags: Test, Metadata

You should find the document then tagged with those tags.

Stephen

1 Like

Thank you, but I’m still a little confused:

MyKey : MyValue
AnotherKey : AnotherValue

First line of normal Text.

In this example, how does DT know that this is metadata? And when it ends? The space before each colon? The fact that it’s the first line? I thought one had to put a colon at the end of the metadata (and then I’m not sure what this means, but also “metadata value”).

Also, I had a colon somewhere far down in my text and it also changed color (maroon-ish and blue)…why the color change at all?

Basically what I want to do something along these lines.

Author: [[XXX]]
Ref: [[ZZZ]]
Date: 2021_10.11
Related: [[AAA]], [[BBB]]

body of text which will also have colons: like this.

Do i have to put a colon after “related:” above?

I tried that w/ a lowercase and uppercase T in tags, and I didn’t see those tags appear in the document in the info panel, or do you mean elsewhere?

Also in my example, why are my [[links]] not clickable?

This is specified in the markdown dialect used by DT, namely Multimarkdown. If you throw that at the search engine of your choice, you’ll get more information.

  1. If you are in list view in DT you can right click on the column headers and choose Tags to display tags. Do you see them then?
  2. Do you see them if, in the sidebar, you go to Tags (below Inbox in my case) and expand that?
  3. In the DT View menu do you have Show Tags enabled? (You should then see them in the tag bar at the bottom of the view window).

Stephen

thanks. I did find this below, but I’m still not clear on what the rule is. Can one use YAML? In this case, e.g. I put — before and after my metadata, but otherwise, is the rule that any text with a colon starting on the first line and ending with a line after is automatically metadata (and does every line have to have a colon in it?)–not sure why I’m not understanding how it works.

MultiMarkdown Metadata

The older and simpler MultiMarkdown Metadata is actually incorporated into a few Markdown parsers. While it has more recently been updated to optionally support YAML deliminators, traditionally, the metadata ends and the Markdown document begins upon the first blank line (if the first line was blank, then no metadata). And while the syntax looks very similar to YAML, only key-value pairs are supported with no implied types. Here is an example from the MultiMarkdown docs:

Title:    A Sample MultiMarkdown Document  

Author: Fletcher T. Penney
Date: February 9, 2011
Comment: This is a comment intended to demonstrate
metadata that spans multiple lines, yet
is treated as a single value.
CSS: http://example.com/standard.css

The MultiMarkdown parser includes a bunch of additional options which are unique to that parser, but the key-value metadata is used across multiple parsers. Unfortunately, I have never seen any two which behaved exactly the same. Without the Markdown rules defining such a format everyone has done their own slightly different interpretation resulting in a lot of variety.

The one thing that is more common is the support for YAML deliminators and basic key-value definitions.

See here for a full and careful explanation of metadata in Multimarkdown.

Stephen

1 Like

Edit: You already have the link to the relevant MMD5 explanation of metadata. All your questions (does it do YAML, do I need colons etc) are answered there.

thanks… i did read that before posting, but alas, it’s over my head. I’m not getting what starts/ends metadata, whether I can use YAML, why my text changes color, both in the first line and in the text below, and why wikilinks are not clickable in metadata.

Starting at the text’s start each line with a key:value pair is metadata.

Metadata ends with a blank line.

It’s by the way really easy to try it yourself, I posted an example.

2 Likes

Metadata start at the first line of the file if and only if there’s a colon on that line.

There can optionally be a --- on the line before and after the metadata. The line after the metadata can also be .... This is to provide better compatibility with YAML, though MultiMarkdown doesn’t support all YAML metadata.

If there’s someting unclear about that, please point out what.

As I said: This is a bug, and you should open a new thread for it.

Metadata is processed as plain text, so it should not include MultiMarkdown markup.

What is not clear about that? If you put [[link]] in your metadata, you’ll get exactly that, namely [[link]] in your metadata. Plain text. You should not include MMD markup in your metadata. (I hinted at that before, btw). If you do use markup, it will not do what it does in the rest of the file. Like putting _italic_ text in your meta data - it will not come out as italic.

Simple to test, btw.

1 Like

that explains it, thanks all!

1 Like

Happy that you’ve found a solution?

1 Like

I did, thank you!

1 Like

This kind of comment is completely uncalled for, even if you think it is honest. The forum is not about judging how long it takes someone to understand something but about helping them. If you do not want to do that, that’s fine too.

3 Likes

Yes, I agree - please don’t do that: it takes me ages sometimes! :rofl:

Stephen

2 Likes