Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rebber

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rebber - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

5

dist/types/table.js

@@ -14,3 +14,3 @@ 'use strict';

})));
var colHeader = '|' + 'c|'.repeat(columns);
var colHeader = '|' + 'X[-1]|'.repeat(columns);
return colHeader;

@@ -26,4 +26,5 @@ };

var colHeader = headerParse(parsed);
var spreadCell = typeof ctx.spreadCell === 'string' ? ctx.spreadCell : ' spread 0pt ';
var caption = node.caption ? '\n\\captionof{table}{' + node.caption + '}\n' : '';
return '\\begin{longtabu}{' + colHeader + '} \\hline\n' + inner + '\\end{longtabu}' + caption + '\n';
return '\\begin{longtabu}' + spreadCell + '{' + colHeader + '} \\hline\n' + inner + '\\end{longtabu}' + caption + '\n';
};

@@ -30,0 +31,0 @@

13

dist/types/tableRow.js

@@ -16,6 +16,15 @@ 'use strict';

var defaultFirstLineRowFont = '\\rowfont[c]{\\bfseries}';
var defaultOtherLineRowFont = '\\rowfont[l]{}';
/* Stringify a tableRow `node`. */
function tableRow(ctx, node) {
function tableRow(ctx, node, index) {
var macro = ctx.tableRow || defaultMacro;
return macro(ctx, node);
var firstLineRowFont = ctx.firstLineRowFont || defaultFirstLineRowFont;
var otherLineRowFont = ctx.otherLineRowFont || defaultOtherLineRowFont;
if (index < 2) {
return (index === 0 ? firstLineRowFont : otherLineRowFont) + '\n' + macro(ctx, node);
} else {
return macro(ctx, node);
}
}
{
"name": "rebber",
"version": "3.0.0",
"version": "3.1.0",
"description": "Stringifies MDAST to LaTeX",

@@ -41,12 +41,12 @@ "repository": "https://github.com/zestedesavoir/zmarkdown/tree/master/packages/rebber",

"babel-jest": "^23.4.0",
"babel-preset-env": "^1.6.1",
"babel-preset-env": "^1.7.0",
"cross-env": "^5.2.0",
"dedent": "^0.7.0",
"del-cli": "^1.0.0",
"eslint": "^5.1.0",
"jest": "^23.4.1",
"eslint": "^5.6.1",
"jest": "^23.6.0",
"remark-parse": "^5.0.0",
"unified": "^7.0.0"
},
"gitHead": "0486309be8aee368f30eaaa2c7d2e1d78c368784"
"gitHead": "f705605b99065e80d020eeba2d5f4c74dd0c901a"
}

@@ -144,6 +144,45 @@ # rebber [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status]

###### `options.table`
(ctx, node) => ``,
To ensure a flexible rendering, `longtabu` environment is used by default.
Table stringification can be configured with some advanced options:
###### `options.spreadCell`
` spread 0pt `
Customize cells spacing (usually done using the `spread` command).
Common commands are ` spread <dimension> ` (add `<dimension>` as spacing ) or ` to <dimension> ` (fix the overall width of table).
Default value is ` spread 0pt ` (natural spacing).
###### `options.firstLineRowFont`
`'\\rowfont[c]{\\bfseries}'`
Customize the first line font (this is useful when your tables always have a header as first line).
Default value is `'\\rowfont[c]{\\bfseries}'` (bold, center aligned).
###### `options.defaultOtherLineRowFont`
`'\\rowfont[l]{}'`
Customize table font for all lines except the first.
Default value is `'\\rowfont[l]{}'` (normal font, left aligned).
###### `options.headerParse: (tableRows) => ''`
(tableRows) => ''
Cunction that computes the "latex header" part of the table environment, this generates strings such as `|c|c|r|`.
It gets an array of all the `tableRow` [mdast] nodes for the table as argument.
Default function extracts the number of columns for each row and uses the `X[-1]` handler ("find the best available width").
The result for a 3 column-table is `|X[-1]|X[-1]|X[-1]|`.
## Related
* [`rebber-plugins`][rebber-plugins]
— A collection of rebber plugins able to stringify custom Remark node types.
- A collection of rebber plugins able to stringify custom Remark node types.

@@ -150,0 +189,0 @@ ## License

@@ -8,3 +8,3 @@ const one = require('../one')

const columns = Math.max(...rows.map(l => l.split('&').length))
const colHeader = `|${'c|'.repeat(columns)}`
const colHeader = `|${'X[-1]|'.repeat(columns)}`
return colHeader

@@ -18,6 +18,7 @@ }

const colHeader = headerParse(parsed)
const spreadCell = typeof ctx.spreadCell === 'string' ? ctx.spreadCell : ' spread 0pt '
const caption = node.caption
? `\n\\captionof{table}{${node.caption}}\n`
: ''
return `\\begin{longtabu}{${colHeader}} \\hline\n${inner}\\end{longtabu}${caption}\n`
return `\\begin{longtabu}${spreadCell}{${colHeader}} \\hline\n${inner}\\end{longtabu}${caption}\n`
}

@@ -24,0 +25,0 @@

@@ -12,6 +12,16 @@ /* Expose. */

const defaultFirstLineRowFont = `\\rowfont[c]{\\bfseries}`
const defaultOtherLineRowFont = `\\rowfont[l]{}`
/* Stringify a tableRow `node`. */
function tableRow (ctx, node) {
function tableRow (ctx, node, index) {
const macro = ctx.tableRow || defaultMacro
return macro(ctx, node)
const firstLineRowFont = ctx.firstLineRowFont || defaultFirstLineRowFont
const otherLineRowFont = ctx.otherLineRowFont || defaultOtherLineRowFont
if (index < 2) {
return `${index === 0 ? firstLineRowFont : otherLineRowFont}\n${macro(ctx, node)}`
} else {
return macro(ctx, node)
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc