support for attribute lists (as in maruku and python markdown)
Subject line says it all. I have been looking at feeding content into a Catalyst/Template Toolkit driven website using my Template::Plugin::Multimarkdown Perl module and there are instances where I want to set a class on an element. The Maruku syntax (https://github.com/bhollis/maruku/blob/master/docs/proposal.md) looks like the nicest way to do this. It would have the added benefit that one could avoid the MMD bug where multiple headings with the same text generate non-unique ids. The id attribute could also be used to generate LaTeX labels.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by fletcher on 12 Jun, 2013 03:20 PM
Andrew,
Thanks for the suggestion. You're not alone. ;)
However, I'm not a huge fan of the various syntaxes used to add attributes like this --- it doesn't really fit with the philosophy of Markdown (avoiding markup that looks like markup.) The approach I used for adding image/link attributes was a compromise -- it clearly is markup, but it's tucked away in the link by reference information where one expects markup, so it doesn't interfere with the flow of the text. Plus, I needed image attributes. ;)
My general take on this is that if there truly becomes one "standard" for this amongst the major Markdown variants, I will consider adding it. For the moment, I don't plan on adding something like this any time soon.
F-
2 Posted by andrew on 12 Jun, 2013 04:59 PM
On 12/06/13 16:20, fletcher wrote:
>
Just listening to you on systematic at the moment ;-)
I think it is a shame that attributes can't be fitted in. My feeling is
that 99% of the time they aren't needed, but just occasionally they are
essential. I looked at the PEG grammar and it looks like they fit in a
similar way to criticmarkdown - I might play with adding conditional
support for them in a fork just for my own benefit.
The MMD app looks and sounds great. Shame it is not available for Android.
Andrew
Support Staff 3 Posted by fletcher on 12 Jun, 2013 10:43 PM
Fork away!
;)
Attributes will probably not actually be very similar to CriticMarkup except at a superficial level (they both use "{...}". You'd be better off looking at the image/link attributes (which are much more complex than critic markup).
F-
fletcher closed this discussion on 12 Jun, 2013 10:43 PM.
andrew re-opened this discussion on 13 Jun, 2013 06:14 AM
4 Posted by andrew on 13 Jun, 2013 06:14 AM
Will do, but it'll wait until after I've got the Text::MultiMarkdown::XS
module written and the Template::Plugin::MultiMarkdown module updated to
use that. github.com/fordmason/Text-MultiMarkdown-XS will use
MultiMarkdown-4 as a git submodule (it is a good introduction for me to
using git).
I meant that the grammar elements of CriticMarkdown would provide some
useful hints for inserting into the grammar. I'll certainly also be
looking hard at the link/images code to figure out how to hook into the
mechanisms for maintaining attributes and affecting the generated output.
Looking at the HTML structure of pages on your multimarkdown.com web
site, I think maybe you're right that attributes are not strictly
necessary in MMD - I am looking to generate content for a Bootstrap
site, but using Catalyst and Template Toolkit rather than from MMD-CMS,
but the effect should be similar. It looks like the elements with
attributes will be inserted by the TT scaffolding rather than the MMD
content.
Andrew
Support Staff 5 Posted by fletcher on 13 Jun, 2013 12:07 PM
I am a strong believer that *most* (not all) users can accomplish *most* (not all) of what they need without a separate syntax for attributes. When using HTML, for example, CSS offers a lot of flexibility to style your pages without much in the way of attributes. Sometimes it does require some creativity, but that's a good thing.
That said, I don't think that attributes are bad, per se. I just think that the syntax proposals I have seen clearly violate the "don't look like markup" rule of Markdown. If you think of a MultiMarkdown document as content, with minimal markup that is focused on those elements with meaning to the user (e.g. headings, emphasis, lists) not to the computer (put 20px of whitespace around this image, and 10px around this one), it becomes hard to argue the need for attributes in most cases.
Another rubric I use for evaluating feature proposals is that a new feature should apply equally (or at least *almost* equally) across output formats (HTML, LaTeX, OpenDocument, etc.) It's hard to imagine attributes of this sort that would have any meaning in HTML and LaTeX, for example. If a feature only applies to one format, it's often a flag that the feature is either too specific, or not really necessary for MMD itself and may be better applied as a separate tool.
I view Markdown/MultiMarkdown not just as a simple form of HTML, but something fundamentally different that is capable of being transformed into HTML.
I explain all this not because I'm right and others are wrong, but to help explain my perspective, and why I make some of the decisions I make.
F-
6 Posted by andrew on 18 Jun, 2013 06:07 AM
I just remembered what my main use case for attributes is - namely adding classes to tables. I am using Twitter Bootstrap and would like to add combinations of classes ".table", ".table-striped" and ".table-bordered" to my MMD-generated tables. Without them the tables look rather dreary. I suppose a document attribute would work for a global set of classes for the tables, but that wouldn't provide individual control.
fletcher closed this discussion on 18 Jun, 2013 07:39 PM.