remark: Style in Code Block

Hello, I wanna do this with remark.js: When inside code block:

function say_hello_to(you) {
    // __I_wanna_be_strong__
    // _I_wanna_emphasize_this_
    // .custom-class[yummy...]
    alert("Hello, " + you + "!");
}

The tokens __strong__, _em_ and .class-name[blah...] should work just as they do outside the block, meaning they are interpreted as strong, em and <div class="class-name">blah...</div>, instead of showing the raw markdown. Is this possible? Maybe process those tokens first then wrap them into a <pre><code></code></pre> block?

I really love remark.js!

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 28 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve thought about this before, but there are several issues depending on how it’s supposed to work.

In your example, however, you only use Markdown inside comments. Is that by coincidence, or are you primarily thinking on styling comments?

Limiting this kind of functionality to comments only makes it pretty straight forward, I think. Styling actual code, however, is a bit more complicated, although it could be super useful.