Skip to content
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

Add support for description lists #254

Closed
adius opened this issue Sep 25, 2013 · 8 comments
Closed

Add support for description lists #254

adius opened this issue Sep 25, 2013 · 8 comments

Comments

@adius
Copy link

adius commented Sep 25, 2013

http://kramdown.rubyforge.org/syntax.html#definition-lists

(In html4 it was called definition list, in html5 its called description list)

@adius
Copy link
Author

adius commented Mar 25, 2014

Would you guys accept a pull request for this?

@rayshan
Copy link

rayshan commented Jun 4, 2014

+1, can just be accessible as a default renderer method.

For reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
This is a standard HTML element.

@gelitenight
Copy link

Any luck?

@samjewell
Copy link

+1

We just used this to solve our problem, similar to the way he does it here for Headings :-

var renderer = new marked.Renderer();
  renderer.paragraph = function (text) {
    var dlTest = /(^|\n\n+)(\S.+)(\n\:(\s{4,}|\t))(\S.+)/

    var dl = '\n\n' +
      '<dl>' +
      '<dt><p>$2</p></dt>' +
      '<dd><p>$5</p></dd>' +
      '</dl>' +
      '\n\n';

    if (text.match(dlTest)) {
      text = text.replace(dlTest, dl);
      return text;
    } else {
      return '<p>' + text + '</p>\n';
    }
  };

It's not perfect, as the <dl> tags get duplicated around each row / definition in the list, but we were happy with the result.

@nschneid
Copy link

nschneid commented Jan 1, 2015

+1 I find that definition lists are incredibly useful!

@ljl
Copy link

ljl commented Sep 28, 2016

+1

@joshbruce
Copy link
Member

We are currently targeting two Markdown specifications. If you can find where the syntax of these two specifications allow dl, please open a new issue with this reference. See #956 - Thank you.

@Crystal-RainSlide
Copy link

Crystal-RainSlide commented Jun 17, 2021

Now this may be implemented as a extension (template) of Marked.

There is xiaoliwang/markedjs-extra for some reference, but it's pretty old.

Also see issue #27.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants