mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Merge pull request #3064 from minrk/header-anchors
add anchors to heading cells
This commit is contained in:
commit
061d27e877
@ -82,6 +82,11 @@ $(document).ready(function () {
|
||||
IPython.layout_manager.do_resize();
|
||||
$([IPython.events]).on('notebook_loaded.Notebook', function () {
|
||||
IPython.layout_manager.do_resize();
|
||||
var hash = document.location.hash;
|
||||
if (hash) {
|
||||
document.location.hash = '';
|
||||
document.location.hash = hash;
|
||||
}
|
||||
});
|
||||
IPython.notebook.load_notebook($('body').data('notebookId'));
|
||||
|
||||
|
@ -516,7 +516,16 @@ var IPython = (function (IPython) {
|
||||
HeadingCell.prototype.set_rendered = function (text) {
|
||||
var r = this.element.find("div.text_cell_render");
|
||||
r.empty();
|
||||
r.append($('<h'+this.level+'/>').html(text));
|
||||
r.append(
|
||||
$('<h'+this.level+'/>')
|
||||
.append(
|
||||
$('<a/>')
|
||||
.addClass('heading-anchor')
|
||||
.attr('href', '#' + text)
|
||||
.attr('name', text)
|
||||
.html(text)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
@ -468,3 +468,8 @@ p {
|
||||
margin-bottom:0;
|
||||
|
||||
}
|
||||
|
||||
a.heading-anchor:link {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user