mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 15:22:41 +00:00
Force lists to be "loose" style (wrap text in <p> tags)
This commit is contained in:
@@ -381,7 +381,12 @@ const forcedParagraphBreaks = {
|
||||
tokenizer(src, tokens) {
|
||||
const regex = /^(:+)(?:\n|$)/ym;
|
||||
const match = regex.exec(src);
|
||||
|
||||
if(match?.length) {
|
||||
const lastToken = tokens[tokens.length - 1];
|
||||
if(lastToken?.type == 'text')
|
||||
lastToken.type = 'paragraph';
|
||||
|
||||
return {
|
||||
type : 'hardBreaks', // Should match "name" above
|
||||
raw : match[0], // Text to consume from the source
|
||||
@@ -395,6 +400,14 @@ const forcedParagraphBreaks = {
|
||||
}
|
||||
};
|
||||
|
||||
const patchHardBreaks = {
|
||||
walkTokens(token) {
|
||||
if(token.type == 'list' || token.type == 'list_item') {
|
||||
token.loose = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const nonbreakingSpaces = {
|
||||
name : 'nonbreakingSpaces',
|
||||
level : 'inline',
|
||||
@@ -774,6 +787,7 @@ Marked.use(MarkedVariables());
|
||||
Marked.use({ extensions : [justifiedParagraphs, definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks,
|
||||
nonbreakingSpaces, mustacheSpans, mustacheDivs, mustacheInjectInline] });
|
||||
Marked.use(mustacheInjectBlock);
|
||||
Marked.use(patchHardBreaks);
|
||||
Marked.use(MarkedSubSuperText());
|
||||
Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false });
|
||||
Marked.use(MarkedExtendedTables({interruptPatterns : tableTerminators}), MarkedGFMHeadingId({ globalSlugs: true }),
|
||||
|
||||
@@ -57,12 +57,13 @@
|
||||
ul {
|
||||
padding-left : 1.4em;
|
||||
margin-bottom : 0.8em;
|
||||
line-height : 1.25em;
|
||||
}
|
||||
ol {
|
||||
padding-left : 1.4em;
|
||||
margin-bottom : 0.8em;
|
||||
line-height : 1.25em;
|
||||
}
|
||||
.page li p {
|
||||
line-height : 1.25em;
|
||||
}
|
||||
//Indents after p or lists
|
||||
p + p, ul + p, ol + p { text-indent : 1em; }
|
||||
@@ -137,6 +138,9 @@
|
||||
line-height : 0.951em; //Font is misaligned. Shift up slightly
|
||||
& + * { margin-top : 0.2cm; }
|
||||
}
|
||||
br + h3, br + h4 {
|
||||
margin-top : 0;
|
||||
}
|
||||
// *****************************
|
||||
// * TABLE
|
||||
// *****************************/
|
||||
|
||||
Reference in New Issue
Block a user