Simplify helpers

This commit is contained in:
Jonny Gerig Meyer 2023-06-22 15:18:23 -04:00
parent 9ac3302fd0
commit 639557c46d
No known key found for this signature in database
5 changed files with 8 additions and 15 deletions

View File

@ -34,6 +34,6 @@
{%- if details | strip -%}
<div class="sl-c-callout sl-c-callout--impl-status">
{% if useMarkdown %}{{ details | markdown }}{% else %}{{ details }}{% endif %}
{{ details | markdown }}
</div>
{%- endif -%}

View File

@ -1,4 +1,4 @@
<div class="sl-c-callout sl-c-callout--fun-fact">
<h3>💡 Fun fact:</h3>
{% if useMarkdown %}{{ contents | markdown }}{% else %}{{ contents }}{% endif %}
{{ contents | markdown }}
</div>

View File

@ -1,4 +1,4 @@
<div class="sl-c-callout sl-c-callout--warning">
<h3>⚠️ Heads up!</h3>
{% if useMarkdown %}{{ contents | markdown }}{% else %}{{ contents }}{% endif %}
{{ contents | markdown }}
</div>

View File

@ -36,7 +36,6 @@ interface CompatibilityOptions {
node: string | boolean | null;
ruby: string | boolean | null;
feature: string | null;
useMarkdown: boolean;
}
const extend = <
@ -64,7 +63,6 @@ const parseCompatibilityOpts = (...args: string[]): CompatibilityOptions => {
node: null,
ruby: null,
feature: null,
useMarkdown: true,
};
const keyValueRegex = /(.*?):(.*)/;
for (const arg of args) {

View File

@ -15,23 +15,18 @@ export {getDocTocData, getToc};
* Returns HTML for a fun fact that's not directly relevant to the main
* documentation.
*/
export const funFact = async (contents: string, useMarkdown = true) => {
return liquidEngine.renderFile('fun_fact', {
export const funFact = async (contents: string) =>
liquidEngine.renderFile('fun_fact', {
contents: stripIndent(contents),
useMarkdown,
});
};
/**
* Returns HTML for a heads-up warning related to the main
* documentation.
* Returns HTML for a heads-up warning related to the main documentation.
*/
export const headsUp = async (contents: string, useMarkdown = true) => {
return liquidEngine.renderFile('heads_up', {
export const headsUp = async (contents: string) =>
liquidEngine.renderFile('heads_up', {
contents: stripIndent(contents),
useMarkdown,
});
};
/**
* Returns HTML for a code block with syntax highlighting via [Prism][].