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

Implement linkable headers #76

Closed
javigomez opened this issue Sep 9, 2014 · 9 comments
Closed

Implement linkable headers #76

javigomez opened this issue Sep 9, 2014 · 9 comments

Comments

@javigomez
Copy link
Contributor

I just found this http://ben.balter.com/2014/03/13/pages-anchor-links/

@Hutchy68 do you think we can add it?

@Hutchy68
Copy link
Contributor

Hutchy68 commented Sep 9, 2014

Looks like a great addition, I'll look into it.

@javigomez
Copy link
Contributor Author

I did a quick test but I think it conflicts with mootools. Didn't had time to check

@Hutchy68
Copy link
Contributor

Hutchy68 commented Sep 9, 2014

Darn Mootools!

@Hutchy68
Copy link
Contributor

Hutchy68 commented Sep 9, 2014

Hey, it looks like we can do it with marked.js.

https://github.com/chjj/marked#overriding-renderer-methods

here is the piece of code which builds the currentDoc or defaults to introduction, followed by the 3 lines which send everything out to show the menu, currentDoc, and version.

window.addEvent('domready', function() {
    var urlParts = document.URL.split('?', 2);
    state = {};
    here = urlParts[0];

    if (urlParts.length > 1)
    {
        var currentDoc = urlParts[1];
    }
    else
    {
        var currentDoc = "coding-standards/introduction.md";
    }

    marked.setOptions({
        gfm: true,
        pedantic: false,
        sanitize: false,
        highlight: function(code, lang) {
            var that;
            Rainbow.color(code, lang, function(hl_code) { that = hl_code; });
            return that;
        }
    })
    populateMenu();
    populateWindow(currentDoc);
    populateVersion();

Looks like this dictates the options of marked.js

marked.setOptions({
        gfm: true,
        pedantic: false,
        sanitize: false,
        highlight: function(code, lang) {
            var that;
            Rainbow.color(code, lang, function(hl_code) { that = hl_code; });
            return that;
        }
    })

The instructions aren't too clear on how to override the renderer.

@javigomez
Copy link
Contributor Author

Neat! it even provides Github flavored markdown https://github.com/chjj/marked#gfm that is awesome for code hightlights

@javigomez
Copy link
Contributor Author

Adding link for document the decisions: https://twitter.com/TomHutchisonJr/status/511215090335752193

@Hutchy68
Copy link
Contributor

Just not if we should use eco or coffeeKup. I like CoffeeKup but the template engine is very picky. One mistake and it breaks until you fix it.

@javigomez
Copy link
Contributor Author

Adding this in case anyone can do progress in the Coding Standards template during the Code Sprint:

Tom Hutchison [11:07 PM]
The new site is still using md files so to drop in changes is easy.

Tom Hutchison [11:05 PM]
Just the title levels need to be tweaked a little. 😄
mainly the missing part is the publishing not creating relative paths correctly with the call to node

Tom Hutchison [11:09 PM]
https://github.com/Hutchy68/coding-std-new

@photodude
Copy link
Contributor

@mbabker can this be closed considering #141

@mbabker mbabker closed this as completed Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants