Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris 92 posts 238 karma points
    Aug 26, 2015 @ 11:31
    Chris
    0

    CodeHighlighter on Website

    Hey,

    I need a front end code highlighter to work inside of umbraco's grid.

    I tried the following: Implemented Steamdev Snippet to my umbraco, added the following setting to my grid:

     {
    "label": "Display as code",
    "description": "Choose which kind of code is used",
    "key": "class",
    "view": "radiobuttonlist",
    "prevalues": [
      "code_snippet_html",
      "code_snippet_javascript",
      "code_snippet_css",
      "code_snippet_ruby"
    ]
    }
    

    And this script:

    //Code Snippet: If code-Datatype is selected in grid and class "code_snippet_xx" is chosen: use code.snippet script
    $('.code_snippet_html').find( "pre" ).addClass("htmlCode");
    $("pre.htmlCode").snippet("html",{style:"navy"});
    

    I would now go to my content node, choose the umbraco "code" editor, add my code inside it and choose the for example "codesnippethtml".

    That all works fine but when I add code without closing tags like this rewrite rule I wrote:

    <rule name="ToGermanPage" enabled="false" stopProcessing="true">
                    <match url="^$" />
                    <conditions>
                        <add input="{HTTP_ACCEPT_LANGUAGE}" pattern="^de" />
                    </conditions>
                    <action type="Redirect" url="/de" />
                </rule>
    

    All tags will get "auto-closed". Here is the rule above on my websites front end:

    rewrite rule bug

    Is there some way to remove this behaviour?

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 26, 2015 @ 12:05
    Warren Buckley
    0

    Hi Chris,
    I would verify this behaviour of this JS library in a static HTML file. As I believe this may be the library of the code highlighter transforming your code snippet as opposed to this being specific to Umbraco.

    Try this in a static file and let me know how you get on.

    Thanks,
    Warren

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies