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.

Add file-name info to code block

See original GitHub issue

Hey, it would be awesome to be able to say state which file one is working on, like so:

<pre><code data-file="prism.js">
   ... code
</pre></code>

This would add something like http://prismjs.com/plugins/show-language/ with the filename in it. Although I think it would be nice if it was within the <pre> tag so that it is all group within a main container.

I am writing some posts with lots of code, so for this it would be very nice to be able to add the filenames.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

4reactions
LeaVeroucommented, Mar 18, 2016

@lukasoppermann You can just add a pseudoelement, like so:

pre[data-file]::before {
  content: attr(data-file);
  position: absolute;
  top: 0;
  right: 0;
}
0reactions
lukasoppermanncommented, Mar 20, 2016

Hey @LeaVerou I am totally with you on this, maybe we should open a new ticket to discuss how the language plugin could be extended / replaced with a more generic plugin that serves the old purpose, but also the new?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Give a code block a filename
This seems like something that's easily solved by using a level 4, 5, or 6 header for the file name, just prior to...
Read more >
Which Markdown formatting should be used for a filename ...
Which Markdown formatting should be used for a filename of code? - Meta Stack Exchange. Stack Overflow for Teams – Start collaborating and ......
Read more >
Code Blocks Extension for filenames and line numbers
I'd like to put forward a proposal to extend code blocks to include a filename, to be used as a caption for the...
Read more >
Extended Syntax
Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code...
Read more >
File Name Change in CodeBlocks - YouTube
How to change the name of main.cpp using the code :: block's IDE … Show more. Show more. Show less. Comments. 6. Add...
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