Skip to content

Strip the dynamically generated ID from syntaxhighligher, respect data-linenum #6

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

Merged
merged 2 commits into from
Jul 20, 2012

Conversation

ajpiano
Copy link
Member

@ajpiano ajpiano commented Jul 19, 2012

Addresses 2 of the 3 points raised in #5. The last issue (syntax highlighting inside of script in html pages) is blocked by thlorenz/node-syntaxhighlighter#2 for now.

ajpiano added 2 commits July 19, 2012 13:13
…t before it is placed into rendered HTML. Respect the "data-linenum" attr and pass it to node-syntaxhighlighter. Partially resolves jquery#5
…age information to prevent presentational styles from getting interpreted as language choies.
@ajpiano
Copy link
Member Author

ajpiano commented Jul 19, 2012

I just updated this with c1dbba, which fixed problems @agcolom identified after looking at the highlighted output on api.jquerymobile.com. <code class="example"> will no longer get identified as a language 'example', and html identification is slightly better.

@@ -110,10 +124,13 @@ grunt.registerHelper("syntax-highlight", function( options, callback ) {
highlight.each( function( index, el ) {
var $t = $(this),
code = $t.html(),
lang = $t.attr("data-lang") || $t.attr("class") || crudeHTMLcheck( code ),
lang = $t.attr("data-lang") || getLanguageFromClass( $t.attr("class") ) || crudeHTMLcheck( code ),
linenum = $t.attr("data-linenum") || 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If data-linenum is not specified, line numbers shouldn't be generated. If its present, but has no value, default to 1. If present, and has a value, use that.

@jzaefferer jzaefferer merged commit c1dbba9 into jquery:master Jul 20, 2012
@jzaefferer
Copy link
Member

Landed, cleaned up a little and release 0.3.1.

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

Successfully merging this pull request may close these issues.

2 participants