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
- #116: Replace initial * with space when highlighting code line. — committed to gnab/remark by gnab 10 years ago
- #116: Replace initial * with space when highlighting code line. — committed to gnab/remark by gnab 10 years ago
- #116: Replace initial * with space when highlighting code line. — committed to gnab/remark by gnab 10 years ago
- #116: Only compensate with space when * is followed by space. — committed to gnab/remark by gnab 10 years ago
- #116: Expose experimental remark.convert. — committed to gnab/remark by gnab 10 years ago
- #116: Fix case-bug not occuring on Windows. — committed to gnab/remark by gnab 10 years ago
- #116: Enable highlighting of code block spans using backticks. — committed to gnab/remark by gnab 10 years ago
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.