Search

I would like to be able to add attributes to headers. This sounds like a job for the Markdown Extra part of the default Markdown suite in Symphony.

I have Markdown Extra chosen on the textarea in the required section. And while normal Markdown is correctly displayed.

## Header 2 ##

Header 2

Markdown Extra notation to add an arttribute falls over and the extra bits shown up as text on the end of the heading.

## Header 2 ## {#header2}

Header 2 ## {#header2}

Fred you could always cheat a little; if you're using the ninja technique to output the html, you can match any h2 tag or other tags that you like; and automatically add a class or id from the handle (though might be a bit more cumbersome to set up)

@gunglien I had considered this, I could also just use raw html, but those strategies seem more cumbersome that figuring out why Markdown Extra is not working as expected.

A correction to my example, adding an id appears to work:

## The Site ## {#someid}

Adding a class name is what falls over:

## The Site ## {.someclass}

Mystery solved.

Classes were added to Markdown Extra with version 1.2.6

Time for some tweaking of the extension.

If you like, you can update Markdown and Markdown Extra and submit a pull request to the Markdown extension on Github. If not that's fine, I can update this weekend.

Thanks Brendo. Alas, I am not github proficient, so I will leave it to you. I tweaked my installation and now have classes with my headings.

Can you tell us here at least, what you changed to make it work?

I've updated the Markdown extension. The changes are on the master branch so feel free to pull on any existing installation.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details