mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Cleaned up MdToHtml style
This commit is contained in:
parent
9c027e59c4
commit
6884dd2b9e
@ -85,7 +85,7 @@ module.exports = function(style, options) {
|
||||
}
|
||||
ul, ol {
|
||||
padding-left: 0;
|
||||
margin-left: ` + listMarginLeft + `;
|
||||
margin-left: 1.7em;
|
||||
}
|
||||
li {
|
||||
margin-bottom: .4em;
|
||||
@ -161,53 +161,6 @@ module.exports = function(style, options) {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/*
|
||||
This is to fix https://github.com/laurent22/joplin/issues/764
|
||||
Without this, the tag attached to an equation float at an absolute position of the page,
|
||||
instead of a position relative to the container.
|
||||
*/
|
||||
.katex-display>.katex>.katex-html {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Remove the indentation from the checkboxes at the root of the document
|
||||
(otherwise they are too far right), but keep it for their children to allow
|
||||
nested lists */
|
||||
#rendered-md > ul > li.md-checkbox {
|
||||
margin-left: -` + listMarginLeft + `;
|
||||
}
|
||||
|
||||
li.md-checkbox {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
li.md-checkbox input[type=checkbox] {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
a.checkbox {
|
||||
border: 1pt solid ` + style.htmlColor + `;
|
||||
border-radius: 2pt;
|
||||
width: 1.1em;
|
||||
height: 1.1em;
|
||||
background-color: rgba(0,0,0,0);
|
||||
text-decoration: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
top: -0.3em;
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
a.checkbox.tick:after {
|
||||
content: "✓";
|
||||
}
|
||||
|
||||
a.checkbox.tick {
|
||||
color: ` + style.htmlColor + `;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
height: auto !important;
|
||||
|
@ -5,6 +5,24 @@ const utils = require('../utils');
|
||||
|
||||
let checkboxIndex_ = -1;
|
||||
|
||||
const checkboxStyle = `
|
||||
/* Remove the indentation from the checkboxes at the root of the document
|
||||
(otherwise they are too far right), but keep it for their children to allow
|
||||
nested lists. Make sure this value matches the UL margin. */
|
||||
|
||||
#rendered-md > ul > li.md-checkbox {
|
||||
margin-left: -1.7em;
|
||||
}
|
||||
|
||||
li.md-checkbox {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
li.md-checkbox input[type=checkbox] {
|
||||
margin-right: 1em;
|
||||
}
|
||||
`;
|
||||
|
||||
function createPrefixTokens(Token, id, checked, label, postMessageSyntax, sourceToken) {
|
||||
let token = null;
|
||||
const tokens = [];
|
||||
@ -42,7 +60,7 @@ function createSuffixTokens(Token) {
|
||||
return [new Token('label_close', 'label', -1)];
|
||||
}
|
||||
|
||||
function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
function installRule(markdownIt, mdOptions, ruleOptions, context) {
|
||||
markdownIt.core.ruler.push('checkbox', state => {
|
||||
const tokens = state.tokens;
|
||||
const Token = state.Token;
|
||||
@ -93,6 +111,8 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
if (!itemClass) itemClass = '';
|
||||
itemClass += ' md-checkbox';
|
||||
currentListItem.attrSet('class', itemClass.trim());
|
||||
|
||||
context.css['checkbox'] = checkboxStyle;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -100,6 +120,6 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
|
||||
module.exports = function(context, ruleOptions) {
|
||||
return function(md, mdOptions) {
|
||||
installRule(md, mdOptions, ruleOptions);
|
||||
installRule(md, mdOptions, ruleOptions, context);
|
||||
};
|
||||
};
|
@ -8,6 +8,21 @@ var katex = require('katex');
|
||||
const katexCss = require('lib/csstojs/katex.css.js');
|
||||
const md5 = require('md5');
|
||||
|
||||
// const style = `
|
||||
// /*
|
||||
// This is to fix https://github.com/laurent22/joplin/issues/764
|
||||
// Without this, the tag attached to an equation float at an absolute position of the page,
|
||||
// instead of a position relative to the container.
|
||||
// 2018-03-13: No longer needed??
|
||||
// */
|
||||
|
||||
// /*
|
||||
// .katex-display>.katex>.katex-html {
|
||||
// position: relative;
|
||||
// }
|
||||
// */
|
||||
// `
|
||||
|
||||
// Test if potential opening or closing delimieter
|
||||
// Assumes that there is a "$" at state.src[pos]
|
||||
function isValidDelim(state, pos) {
|
||||
|
Loading…
Reference in New Issue
Block a user