question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

custom syntax for code block

See original GitHub issue

I’m trying making something like this

```ttt
some code without syntax highlight
```

and want the code to be highlighted just like well-known language syntax

```javascript
some code with syntax highlight
```

How can i do it?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ZigZagTcommented, Oct 9, 2016

I had checked the r markdown specification and had learn about the knitr engine. And I found these problems:

  • The language-markdown package works with the {javascript } code block, but I have to insert a whitespace between javascript and }. It seems a little bug.
  • In R markdown, in the '''{r } '''(for convenience, I’m using ’ to replace in this comment) pattern, the prefix{rshould be a keyword indicates that the R markdown parser should treat this "code block" as an "code chunk". The language used inside the chunk should be specified by theengineoption. For example,‘’‘{r engine=“javascript”} ‘’‘indicates that this code chunk contains javascript code. This is doced [here](http://yihui.name/knitr/demo/engines/). Any code chunk beginning label replaces therin’’'{r } ‘’'with other language name, should be an shorthand or theengineoption. doced [here](http://rmarkdown.rstudio.com/authoring_knitr_engines.html). Language-markdown package seems not supports theengine` option grammar.
0reactions
burodepepercommented, Oct 27, 2016

That depends on the language ; )

The source.languagename you are referring too is the base scope that these grammars use. Atom is essentially a webpage, and this base scope is the css class given to a line that contains code from that particular language. The thing is, it differs for a number of languages.

The easiest way to find this scope is to open the main grammar file for a language (grammars/language-markdown.json in the case of this package) and (usually) near the top of the file you’ll see an item named scopeName, and that’s the value you are looking for that you’ll need for the include section of the fenced-code bit. The scopeName for language-latex would be text.tex.latex.

Latex will be added in an upcoming version though. I’ve recently added support for inline math, and it’s part of that. If you need help with any other languages, feel free to open a new issue, point me to the language-packages, and it should be in the next version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and highlighting code blocks - GitHub Docs
Share samples of code with fenced code blocks and enabling syntax highlighting. Fenced code blocks. You can create fenced code blocks by placing...
Read more >
Extended Syntax - Markdown Guide
The basic Markdown syntax allows you to create code blocks by indenting lines by four spaces or one tab. If you find that...
Read more >
Code blocks - Material for MkDocs - GitHub Pages
This configuration enables syntax highlighting on code blocks and inline code ... a custom title can be added to a code block by...
Read more >
Custom Syntax Highlighting In Code::Blocks IDE - Codeforces
Custom Syntax Highlighting In Code::Blocks IDE ... vanilla codeblocks theme , Follow this installation guide to get the custom colourful new Themes :-...
Read more >
Use your own syntax highlighter for code blocks
Highlight the code and select the Preformatted Text option in the formatting dropdown (or use Ctrl + Alt + 7). With the code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found