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 markdown-it-classy #27

Closed
wants to merge 1 commit into from

Conversation

m3t
Copy link

@m3t m3t commented Dec 5, 2015

BTW there's an issue which remains:

_em {classy}_ and __strong {classy}__ are supported as well.

does not convert to

<p><em class="classy">em</em> and <strong class="classy">strong</strong> are supported as well.

@celsomiranda
Copy link
Collaborator

I've been trying to fix the issue, but couldn't. Would preferer to merge only when it's fixed.

@curbengh
Copy link
Contributor

curbengh commented Aug 13, 2020

does not convert to

Inline {classy} doesn't work even when used directly.

const classy = require("markdown-it-classy")
const MarkdownIt = require("markdown-it")
const md = new MarkdownIt()

md.use(classy);

const input = `_em {classy}_ and __strong {classy}__ are supported as well.

This is paragraph 2 and I wish there was a way to make it blue.
{blue}

## All kinds of headings work! {classy}`

console.log(md.render(input))
/*
<p><em>em {classy}</em> and <strong>strong {classy}</strong> are supported as well.</p>
<p class="blue">This is paragraph 2 and I wish there was a way to make it blue.</p>
<h2 class="classy">All kinds of headings work!</h2>
*/

"package.json"

  "dependencies": {
    "hexo": "^5.0.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-index": "^2.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-markdown-it": "^4.1.0",
+    "markdown-it-classy": "^0.2.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-server": "^2.0.0"
  }
# _config.yml
markdown:
  plugins:
    - markdown-it-classy

The plugin did load with above configs.

@curbengh curbengh closed this Aug 13, 2020
@curbengh
Copy link
Contributor

As an alternative, you could use markdown-it-attrs which is more active.

Syntax is slightly different (notice the dot .)

_em_{.classy} and __strong__{.classy} are supported as well.

This is paragraph 2 and I wish there was a way to make it blue.
{.blue}

## All kinds of headings work! {.classy}
<p><em class="classy">em</em> and <strong class="classy">strong</strong> are supported as well.</p>
<p class="blue">This is paragraph 2 and I wish there was a way to make it blue.</p>
<h2 class="classy" id="All-kinds-of-headings-work">All kinds of headings work!</h2>

It also supports custom attribute:

text {data-toggle=modal}
<p data-toggle="modal">text</p>

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

Successfully merging this pull request may close these issues.

None yet

3 participants