-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow indication of language for code blocks (esp. inline) #96
Comments
Unless the code block is in different language? But, yep, that would look fine. The issue with the raw class isn't typing, but the fact that you can't use it in strict mode. So there should be something like this. In TXP.com forum code we extended Textile and used the first line for the language identifier GitHub style, but if we can get an actual attribute to Textile that can handle that, then more the merrier. The language attribute should be fine, I believe. Altho, it will remove the ability to use language for code blocks. |
@gocom Your comment and linked example triggers various thoughts...
|
Ah, strict mode. Ok that kills combination with classes anyway so we'd have to allow a very limited |
I got my example above slightly wrong. The W3 spec says it is to go on the
...would give...
...if we follow the spec (which is merely a suggestion anyway.) Doing it like this isn't going to be compatible with every syntax highlighter so we should either reserve it in Textile's syntax but hand the implementation off to a plugin subsystem or close the issue. |
It would be really handy to revisit this issue and allow for classnames to be applied to the inner Don't hardcode it to use any predefined So, as an example, using:
Would render:
|
@philwareham Just pushed a test branch that has this feature in it. Please try out the issue-96 branch and let me know if it does what you need. |
@netcarver works great for me, thanks! |
@philwareham Thanks for testing. Do you anticipate any call for this on inline code elements? |
I guess it's always good to have the option available for inline too, if it's not too much trouble to implement. |
Looking at the source for handling the inline code spans - I'm inclined to leave it to a later version unless there is demand for it. |
No worries. It's edge case stuff really. |
I've added the "Breaks backwards compatibility" label as this change will cause a small variation in the generated output if anyone happens to be using the language attributes on a block code element. |
It would be useful to allow some kind of language markup on code blocks to better support syntax highlighting.
bc.
andbc..
already support class, id, style and language attributes but inline code@...@
has no support for any of these. In addition, the W3 spec suggest the use of classes named after the programming language but prefixed with "language-" be used on the<code>
elements.Currently typing...
...into textile would lead to...
...which doesn't follow this suggestion. In keeping with textile's aim of trying to reduce keystrokes, perhaps we need a new convention for 'language tagging' of code blocks.
Should we override the use of the existing language attribute marker for code blocks or do something different again? Ideas anyone?
The text was updated successfully, but these errors were encountered: