浏览代码

moved padding to css, fix font size for code tag again

Zuoyuan Huang 6 年之前
父节点
当前提交
e67e58d0f6
共有 2 个文件被更改,包括 11 次插入5 次删除
  1. 6 4
      packages/toc/src/generators/notebookgenerator/itemrenderer.tsx
  2. 5 1
      packages/toc/style/index.css

+ 6 - 4
packages/toc/src/generators/notebookgenerator/itemrenderer.tsx

@@ -32,7 +32,6 @@ export function notebookItemRenderer(
     item.type === INotebookHeadingTypes.markdown ||
     item.type === INotebookHeadingTypes.header
   ) {
-    const paddingLeft = 24;
     const collapseOnClick = (cellRef?: Cell) => {
       let collapsed = cellRef!.model.metadata.get(
         'toc-hr-collapsed'
@@ -57,8 +56,8 @@ export function notebookItemRenderer(
               numbering +
               options.sanitizer.sanitize(item.html, sanitizerOptions)
           }}
-          className={item.type + '-cell'}
-          style={{ fontSize, paddingLeft }}
+          className={item.type + '-cell toc-cell-item'}
+          style={{ fontSize }}
         />
       );
       // Render the headers
@@ -116,7 +115,10 @@ export function notebookItemRenderer(
     ) {
       // Render headers/markdown for plain text
       jsx = (
-        <span className={item.type + '-cell'} style={{ fontSize, paddingLeft }}>
+        <span
+          className={item.type + '-cell toc-cell-item'}
+          style={{ fontSize }}
+        >
           {numbering + item.text}
         </span>
       );

+ 5 - 1
packages/toc/style/index.css

@@ -338,5 +338,9 @@
 }
 
 .jp-TableOfContents-content code {
-  font-size: 9px;
+  font-size: inherit;
+}
+
+.toc-cell-item {
+  padding-left: 24px;
 }