Skip to content
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

Question: Where is the language class set? #725

Closed
dpilafian opened this issue Mar 18, 2017 · 6 comments
Closed

Question: Where is the language class set? #725

dpilafian opened this issue Mar 18, 2017 · 6 comments

Comments

@dpilafian
Copy link

dpilafian commented Mar 18, 2017

Where is the language class set?

The multiple-tabs-per-language feature (issue #58) seems to have broken gulp-slate by changing the selector ("highlight.python" -> "highlight.tab-python") but not changing the class on the elements.

Commit:
1fd867c#diff-b452c5e9ae6b467f9652d0af37b951fd

The effect is that the all code snippets are displayed all the time. However, this is not a problem with regular Slate only with gulp-slate. With gulp-slate, the <pre> block has the python class but not the tab-python class. Regular Slate has both classes.

@dpilafian
Copy link
Author

If you landed here looking for a temporary workaround, a very kludgy hack is to insert the following code at the bottom of your index.html.md file.

index.html.md

<script>
function addTabPrefix(lang) { $('.highlight.' + lang).addClass('tab-' + lang); }
function fixLanguages() { $('body').data().languages.forEach(addTabPrefix); }
$(fixLanguages);
</script>

@MikeRalphson
Copy link
Contributor

MikeRalphson commented Mar 18, 2017

@dpilafian is it not in lib/multilang.rb L.6 ? gulp-slate doesn't seem to have an equivalent modification. Think it is an issue for that project.
Advert shins is Slate v1.5.0 compatible, though it doesn't come with its own gulp task. I don't think any of the other Node.js Slate ports have been updated yet. 1 2

@lord
Copy link
Member

lord commented Mar 18, 2017

👍 if this is a problem only with gulp-slate, and not us, it's probably best to submit the issue to them!

@lord lord closed this as completed Mar 18, 2017
@dpilafian
Copy link
Author

This issue was filed as a question not a bug. I intend to fix it on gulp-slate (original question noted: this is not a problem with regular Slate).

_lang.js used to look for the language class but now looks for the tab class, however the old language class remains (that's where I got derailed). Since the language class is not used by _lang.js anymore, it doesn't matter where the language class is set (although, I'm still kind of curious).

BTW, gulp-slate does indeed pull down the new multilang.rb file, but it does not appear to get executed. At least now I know where to look to fix it.

@lord
Copy link
Member

lord commented Mar 18, 2017

Ah, sorry, I misunderstood! Yup, multilang.rb is where it's set.

@dpilafian
Copy link
Author

Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants