Prechádzať zdrojové kódy

Use unique ids to prevent interfering with toc links

simov 8 rokov pred
rodič
commit
c83ca54177
2 zmenil súbory, kde vykonal 7 pridanie a 7 odobranie
  1. 4 4
      content/content.js
  2. 3 3
      css/content.css

+ 4 - 4
content/content.js

@@ -73,17 +73,17 @@ function mount () {
       var dom = []
 
       if (state.raw) {
-        dom.push(m('pre#markdown', {oncreate: oncreate.markdown}, state.markdown))
+        dom.push(m('pre#_markdown', {oncreate: oncreate.markdown}, state.markdown))
         $('body').classList.remove('_toc-left', '_toc-right')
       }
       else {
         if (state.theme) {
-          dom.push(m('link#theme [rel="stylesheet"] [type="text/css"]', {
+          dom.push(m('link#_theme [rel="stylesheet"] [type="text/css"]', {
             href: chrome.runtime.getURL('/themes/' + state.theme + '.css')
           }))
         }
         if (state.html) {
-          dom.push(m('#html', {oncreate: oncreate.html,
+          dom.push(m('#_html', {oncreate: oncreate.html,
             class: /github(-dark)?/.test(state.theme) ? 'markdown-body' : 'markdown-theme'},
             m.trust(state.html)
           ))
@@ -134,7 +134,7 @@ else {
 
 var toc = (
   link = (header) => '<a href="#' + header.id + '">' + header.title + '</a>') =>
-  Array.from($('#html').childNodes)
+  Array.from($('#_html').childNodes)
   .filter((node) => /h[1-6]/i.test(node.tagName))
   .map((node) => ({
     id: node.getAttribute('id'),

+ 3 - 3
css/content.css

@@ -5,7 +5,7 @@ html, body {
   width: auto !important; max-width: 100% !important;
 }
 
-pre#markdown {
+pre#_markdown {
   word-wrap: break-word;
   white-space: pre-wrap;
 }
@@ -23,10 +23,10 @@ pre#markdown {
   padding: 45px;
   margin: 20px auto;
 }
-.markdown-body #html>*:first-child {
+.markdown-body #_html>*:first-child {
   margin-top: 0 !important;
 }
-.markdown-body #html>*:last-child {
+.markdown-body #_html>*:last-child {
   margin-bottom: 0 !important;
 }
 .markdown-body img {