-
Notifications
You must be signed in to change notification settings - Fork 22.7k
[Markdown] First draft of Markdown spec #3950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Preview URLsFlawsURL: No flaws! 🎉 External URLsURL:
|
|
||
<h3>KumaScript</h3> | ||
|
||
<p>Writers will be able to include KumaScript macro calls in prose content:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth saying that this can be both as a block or inline (otherwise you might assume from example that the macro must be on its own line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of this but then struggled to come up with an inline macro other than *xref, and I expect these to disappear eventually. I guess I could have {{optional_inline}}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about {{readonlyinline}}?
|
||
<h3>Tables</h3> | ||
|
||
<p>In GFM (but not CommonMark) there is a syntax for tables: <a href="https://github.github.com/gfm/#tables-extension-">https://github.github.com/gfm/#tables-extension-</a>. We will make use of this but it should be noted that this syntax imposes limitations on the kinds of tables we can write, so in many cases this syntax will not be appropriate and we will need alternative ways of authoring tables.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I have never seen a great markdown syntax for tables, in particular tables that support merging adjacent cells. The solution has always been to allow HTML for more complicated tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree. I will have an issue for tables, and I think it's likely we'll end up deciding to use HTML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IFF we want to use markdown for more tables we could invent a syntax to apply a style to a markdown block. This would allow us to use markdown for a bigger number of tables - ie. with basic styling like "hide the header" and "add a header column". I've seen this approach in reStructured text, but not in markdown systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree with this too. markdown table syntax is really horrible, and I think we'll need to resort to HTML here.
<ul> | ||
<li>GFM tables must have a header row.</li> | ||
<li>GFM tables may not have a header column.</li> | ||
<li>GFM won't parse GFM block elements in table cells.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But they will parse html in GFM table cells .... though this sux because you have to have the whole table on one line.
<ul> | ||
<li>GFM tables must have a header row.</li> | ||
<li>GFM tables may not have a header column.</li> | ||
<li>GFM won't parse GFM block elements in table cells.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't apply CSS styling in markdown on a per-table basis. You also can't apply particular styling to rows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't call this out here because that's true of all elements in GFM, and is not specific to tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I only raised it because tables are the only place where I ever feel the need to add styling from whatever the site-wide setting is. So this is "where the lack matters".
</pre> | ||
|
||
<p>...then the attempt to write a list in the bottom-right cell will just generate <code><td>* lists aren't</td></code> in the output.</p> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI only, the "standard" form for a table in markdown (as shown above) looks like a table. This is cool until you have to write one, or modify the content in any column.
There is a simpler syntax which I usually prefer to use because you don't, as an author, have to think too much about the layout at authoring time.
Header 1 | Header2
--- | ---:
I'm a test | yes i am
`inline` is ok | * lists aren't
Which renders as
Header 1 | Header2 |
---|---|
I'm a test | yes i am |
inline is ok |
* lists aren't |
Note:
- You must have the header
- Colon can be used in the line after header to indicate alignment of the column text
|
||
<h3>Inline styles</h3> | ||
|
||
<h3>KumaScript</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Images heading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand this comment.
@wbamberg My 2 bits. Yes to all your questions, at least for now. This reads as what it is - a spec with some reasoning and justification and comparison. That's good for first author and implementer audience. Later on we should simplify it down to a cheatsheet - e.g. like https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet along with a list of things that we know can't be ported using markdown in our system (I'm thinking some tables - we may need to think up some way to apply per-table styling). |
Yes
I agree it’s a good approach. In general with pretty much everything we do, I prefer the approach of landing something and than iterating on it over time — rather than blocking on trying to make it problem-free from the get-go.
I think it’s useful to have the info summarized at point-of-use.
I’d prefer to have the entire doc written in markdown rather than HTML :) |
The irony of laboriously writing out, in HTML, a document about using Markdown, was not lost on me :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @wbamberg ! I've left a few comments for you, but nothing major.
|
||
<p>GFM and CommonMark describe some extensions to <a href="https://daringfireball.net/projects/markdown/syntax">the original Markdown description</a>). We'll highlight three that are going to be important to us. | ||
|
||
<h3>Markdown in HTML blocks</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies we'll be regularly including HTML blocks inside MDN markdown content, whereas I thought we were trying to minimize this as much as possible? I don't really get the point of this section, and why we need to include the <div>
in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the transition to markdown, mixing might be a useful allowance. Though, I would call it out as something that is a temporary allowance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I can remove this.
|
||
<h3>Tables</h3> | ||
|
||
<p>In GFM (but not CommonMark) there is a syntax for tables: <a href="https://github.github.com/gfm/#tables-extension-">https://github.github.com/gfm/#tables-extension-</a>. We will make use of this but it should be noted that this syntax imposes limitations on the kinds of tables we can write, so in many cases this syntax will not be appropriate and we will need alternative ways of authoring tables.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree with this too. markdown table syntax is really horrible, and I think we'll need to resort to HTML here.
<li>GFM won't parse GFM block elements in table cells.</li> | ||
</ul> | ||
|
||
<p>This last means that if you write:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
word missing from this sentence?
|
||
<p>GFM and CommonMark describe some extensions to <a href="https://daringfireball.net/projects/markdown/syntax">the original Markdown description</a>). We'll highlight three that are going to be important to us. | ||
|
||
<h3>Markdown in HTML blocks</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the transition to markdown, mixing might be a useful allowance. Though, I would call it out as something that is a temporary allowance.
|
||
<h3>KumaScript</h3> | ||
|
||
<p>Writers will be able to include KumaScript macro calls in prose content:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about {{readonlyinline}}?
Co-authored-by: Joe Medley <[email protected]>
Preview URLsFlawsURL: No flaws! 🎉 External URLsURL:
|
Preview URLsFlawsURL: No flaws! 🎉 External URLsURL:
|
…markdown-spec * origin/draft-markdown-spec: Update files/en-us/mdn/contribute/markdown_in_mdn/index.html
Preview URLsFlawsURL: No flaws! 🎉 External URLsURL:
|
OK, I pushed some changes which I hope resolve the comments, and asked for clarification on a couple of comments that I didn't understand... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm happy with this as it stands. We can publish now and iterate later.
Anyone else got any other significant concerns before we merge? |
Here's a first draft of a spec for writing Markdown in MDN.
The idea is that this specifies a baseline (GFM) and we then add extra bits for anything else we need to support. Adding these extra bits would be separate PRs which would close separate issues, like #3483.
However, I included a resolution for #3512 to show what it would look like, and because this seemed like it could be resolved in the way I've written it up here.
So anyway, I'm interested in things like:
There is also a need for some other spec about how we manage the conversion - how we get from the HTML we have to this Markdown. But since that's more of a project doc that has a limited shelf-life, it seems better to keep is separate. Then this doc can just talk about how things will be in the end state.