sass-site/source/helpers/engines.ts
Jonny Gerig Meyer 18730944a6
Merge branch 'port-documentation-var-interp-atrules' into command-line
* port-documentation-var-interp-atrules: (21 commits)
  address review
  review
  Add logic for auto-expanded secondary toc.
  review
  Dynamically generate doc inner TOCs.
  Fixing spacing issues in Operations list
  Switching links to absolute paths, updating headsUp tags and compat tags
  Removing anchor links from Page Sections headings
  More human-friendly hash slugs
  Fix compat tables
  Do not attempt to lint generated files
  Generate doc toc dynamically.
  add missing link
  Porting Documentation - At-Rules - import
  Lint
  Porting Documentation - At-Rules - @forward
  Updating codeExample logic to account for when there is no CSS in the code examples
  Porting Documentation - At-Rules - @use
  Porting Documentation - At-Rules - Overview
  Porting documentation - Interpolation
  ...
2023-05-25 15:19:20 -04:00

45 lines
1.2 KiB
TypeScript

import slugify from '@sindresorhus/slugify';
import { Liquid } from 'liquidjs';
import markdown from 'markdown-it';
import markdownAnchor from 'markdown-it-anchor';
import markdownItAttrs from 'markdown-it-attrs';
import markdownDefList from 'markdown-it-deflist';
import path from 'path';
import { renderPermalink } from './components/anchors';
/**
* Returns Markdown engine with custom configuration and plugins.
*
* @see https://github.com/markdown-it/markdown-it
* @see https://github.com/markdown-it/markdown-it-deflist
* @see https://github.com/arve0/markdown-it-attrs
* @see https://github.com/valeriangalliat/markdown-it-anchor
*/
export const markdownEngine = markdown({
html: true,
typographer: true,
})
.use(markdownDefList)
.use(markdownItAttrs)
.use(markdownAnchor, {
level: 2,
permalink: renderPermalink,
slugify: (s) => slugify(s),
});
/**
* Returns LiquidJS engine with custom configuration.
*
* @see https://liquidjs.com/
*/
export const liquidEngine = new Liquid({
root: [
path.resolve(__dirname, '../_includes/'),
path.resolve(__dirname, '../'),
],
extname: '.liquid',
strictFilters: true,
jsTruthy: true,
});