While it has by now been determined that music.SE wants ABC music markup, and the SE community managers have taken note, the integration remains to be implemented. A crucial point where this touches the users is: how can we best include ABC snippets within the Markdown of answers?
3 Answers
$
is a good delimiter character – it is long established on other SE sites for LaTeX / MathJax notation, and is not hard-wired in ABC syntax. However, I would vote for using the doubled variant $$
, for the following reasons:
- ABC allows assigning characters as line-delimiters, and
$
is the recommended choice for this (though!
is also possible). Unless there's a good reason, we should not undermine this. - Music snippets will always be “displays”, i.e. set apart from the surrounding text rather than inline with words of that text. This is analogous to the
$$
TeX math display delimiter, whereas$
delimits simple inline maths expressions. It would be somewhat inconsistent if we now used single$
for music displays.
So,
Example of how a ABC-featuring post could look in Markdown editor.
$$
M: 4/4
L: 1/8
K: Dmaj
|:D3 EFGFC|D2 A2 AF2E|D4 B2C2:|
$$
This should then be easy to parse, and process using the existing ABCjs plugin,
and give nice notation output!
We already have jTab support that works without any delimiter. So we will now have 2 different "languages". There might also potentially be need for having support for other stuff in the future.
So would it be smart to name the plugin?
$ABC$
X: 1
M: 4/4
L: 1/8
K: Dmaj
|:D3 EFGFC|D2 A2 AF2E|D4 B2C2:|
$ABC$
And for consistency, also support specifying jTab block:
(but keep jTab as default if needed for backward-compability - see comments)
$TAB$
C E F
$TAB$
If we need to keep jTab as default, there are also use cases where you want to have a monospace code block, but not parsed with jTab. Even though it might not be the most common case, it should be really easy to implement, and I found at least three feature requests for this (here, here and here).
It could be something like this:
$TEXT$
C B A F G Eb C B A
Sing along a song with notation without display chords here and there, lalala...
$TEXT$
Status: Almost complete....
OK, as ABCjs is now implemented, this is quite good, but I still miss the possibility to mark code block with just letters like the last example. I guess we could use inline coding like I have done above.
The best alternative is probably to use <pre>
like this:
C B A F G Eb C B A Sing along a song with notation without display chords here and there C G Emaj7 B C A C A C but still position the chord names at the right position above lyrics.
-
2Good point about jTab, which IMHO does not work very satisfyingly – posting monospace plaintext snippets in the way that's possible on any other SE site is always a bit of a roulette here. Hence, I would agree on
$ABC$
and$TAB$
, together with removal of jTab defaulting. OTOH, I think this is a bit YAGNI and contrary to the spirit of Markdown (as well as ABC), hence I still stay with my$$
suggestion. Commented May 11, 2016 at 12:18 -
1It would be bad to remove jTab defaulting, because there is a lot of existing content that relies on it. It could maybe be done if the SE team can do a global insertion of the $TAB$ tags in the music.SE database for code blocks when applying the new notation support, but that would be potentially dangerous... It is an idea for the SE team, and they can do it if they feel confident that they can do it in a way that does not break any content.– aweCommented May 11, 2016 at 12:24
-
3I think existing SE posts are generally not affected by syntax changes (apparently, each post is always saved in two forms – editable source code and some kind of lower-level persistent format), so this would only be an issue whenever somebody edits an old post with jTab in it. But I could be wrong here. Commented May 11, 2016 at 12:28
-
1If that's true, it would be great! The SE team obviously knows this, so we leave it up to them to decide. We can agree on that removing the defaulting to jTab would be very nice.– aweCommented May 11, 2016 at 12:40
Note: based on comments below I am effectively withdrawing my answer as a recommendation, but am leaving up in case anyone else has a similar thought.
Markdown uses a suffix description of the language that is to follow. Here's an example, using the $ symbol that seems to be popular here:
$$$abc
music markup here
more music markup here
the line beneath this closes this block statement
$$$
Personally, I'd prefer to use the grave symbol (which is often the same key as tilde ~ ) for several reasons
- it's what is used in Markdown
- the $ symbol is usually reserved for variable names in many computer programming languages
- the grave symbol looks more eloquent when editing
For example:
```abc
music markup here
more music markup here
the line beneath this closes this block statement
```
-
2Markdown uses backticks for preformatted code snippets, that's very different from a domain-specific language like ABC since the source code is visible in public, rather than a rendered result. As for
$
being reserved in some programming languages... why would that be relevant here? They are not used for variables in ABC, isn't that all that matters? And FWIW, use of$
as a rendering-delimiter character in TeX is almost as old as its use for variable names in Unix shells. Commented May 28, 2016 at 11:11 -
Good points, thank you. My thoughts on not using $ were to pre-preemptively anticipate if ABC were ever extended to include variables, but (and I didn't know this) since Tex uses it as a convention it makes sense to use it. Commented May 28, 2016 at 12:48