Add class= and target= to output

Steve Champion's Avatar

Steve Champion

01 May, 2012 07:10 PM

Just downloaded and tried your product (pretty cool by the way). I was trying to find a way to extend the HTML tag output so that things were added as a default when processing. A couple of examples:

Web Site would convert to Web Site or

  • List Item 1
  • List Item 2

would convert to

  • List Item 1
  • List Item 2

I write essentially a blog where a lot of the CSS is already defined or the tag structure requires some additional elements that (I don't believe) are handled in CSS.

Ideally I'd like to modify this myself so that I can have different types of HTML output based on the CSS that is already defined or the publication rules for more than one site, but differ enough that they require different rules.

Also, I tend to keep all of my articles that I write in a site specific Scrivener project file, not separately. Right now I handle that by copying to TextWrangler then use Marked.

  1. 1 Posted by Steve Champion on 01 May, 2012 07:13 PM

    Steve Champion's Avatar

    Sorry, looks like my syntax example was converted for me :-(

    The html for the first (without the angle brackets would be:
    a href="http: / / website" target="_blank" Web Site /a

    and the second would be:

    ul class="something"

  2. Support Staff 2 Posted by Brett on 01 May, 2012 07:31 PM

    Brett's Avatar

    I'm afraid this isn't a possibility with the default MultiMarkdown processor. There are, however, some custom processors that let you define classes on block elements such as UL (I think Kramdown and Maruku can do it). Custom processors are fairly easy to set up, but they _will_ change other parsing capabilities as well. Let me know if you need a hand with that.

  3. 3 Posted by Steve Champion on 01 May, 2012 07:43 PM

    Steve Champion's Avatar

    OK - thanks for the fast response. I understand.

    Just as an "open thought", it does make writing for a website that has pre-defined publishing rules and custom CSS tags that need to be inserted a bit more problematic.

    Just wondered if I hacked John Gruber's markdown.pl perl script to do this, could I add that as a custom markdown processor? I'm kind of new to this...

  4. Support Staff 4 Posted by Brett on 01 May, 2012 07:57 PM

    Brett's Avatar

    Yes, you can add any script that takes input on STDIN and outputs to STDOUT work as a custom processor (which Markdown.pl does by default).

    Neither Markdown nor Marked are designed to output complete websites, and websites generally shouldn't be designed such that classes and extra markup are required within the content (with the exception of image alignment). I know there are special cases, but adding markup into the output is costly for processing and adds many variables to deal with.

    -Brett

  5. 5 Posted by Vikulki on 05 Feb, 2016 08:58 PM

    Vikulki's Avatar

    I m actually trying to add font-awesome icons to my anchor elements using dashboard css custom class box and unfortunately that box, adds icons to li tag and not to a tags.

  6. 6 Posted by Gamerbaks on 06 Feb, 2016 03:47 PM

    Gamerbaks's Avatar

    I m actually trying to add font-awesome icons to my anchor elements using dashboard css custom class box and unfortunately that box, adds icons to li tag and not to a tags.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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