From dfe42567309de15c10f29e38dfb6caac627dfa84 2013-04-07 19:15:57
From: MinRK <benjaminrk@gmail.com>
Date: 2013-04-07 19:15:57
Subject: [PATCH] minor heading-link tweaks

- use id instead of name
- replace spaces with `_`

for html compliance
---

diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js
index fee6a44..f16a7f5 100644
--- a/IPython/frontend/html/notebook/static/js/textcell.js
+++ b/IPython/frontend/html/notebook/static/js/textcell.js
@@ -516,13 +516,14 @@ var IPython = (function (IPython) {
     HeadingCell.prototype.set_rendered = function (text) {
         var r = this.element.find("div.text_cell_render");
         r.empty();
+        var link = text.replace(/ /g, '_');
         r.append(
             $('<h'+this.level+'/>')
             .append(
             $('<a/>')
                 .addClass('heading-anchor')
-                .attr('href', '#' + text)
-                .attr('name', text)
+                .attr('href', '#' + link)
+                .attr('id', link)
                 .html(text)
             )
         );