* First run of script * Get the app running --- ish * Get NextJS working * Remove `node:` * Get more tests passing in unit directory * Update FailBot test to use nock * Update test.yml * Update Dockerfile * tests/content fixes * Update page.js * Update build-changelog.js * updating tests/routing * Update orphan-tests.js * updating tests/rendering * Update .eslintrc.js * Update .eslintrc.js * Install jest/globals * "linting" tests * staging update to server.mjs * Change '.github/allowed-actions.js' to a ESM export * Lint * Fixes for the main package.json * Move Jest to be last in the npm test command so we can pass args * Just use 'npm run lint' in the npm test command * update algolia label script * update openapi script * update require on openapi * Update enterprise-algolia-label.js * forgot JSON.parse * Update lunr-search-index.js * Always explicitly include process.cwd() for JSON file reads pathed from project root * update graphql/update-files.js script * Update other npm scripts using jest to pass ESM NODE_OPTIONS * Update check-for-enterprise-issues-by-label.js for ESM * Update create-enterprise-issue.js for ESM * Import jest global for browser tests * Convert 'script/deploy' to ESM Co-authored-by: Grace Park <gracepark@github.com> Co-authored-by: James M. Greene <jamesmgreene@github.com>
60 lines
2.3 KiB
JavaScript
60 lines
2.3 KiB
JavaScript
import GithubSlugger from 'github-slugger'
|
|
import renderContent from './renderContent.js'
|
|
import { ExtendedMarkdown, tags } from '../liquid-tags/extended-markdown.js'
|
|
import xLink from '../liquid-tags/link.js'
|
|
import xLinkWithIntro from '../liquid-tags/link-with-intro.js'
|
|
import xHomepageLinkWithIntro from '../liquid-tags/homepage-link-with-intro.js'
|
|
import xLinkInList from '../liquid-tags/link-in-list.js'
|
|
import xTopicLinkInList from '../liquid-tags/topic-link-in-list.js'
|
|
import xIndentedDataReference from '../liquid-tags/indented-data-reference.js'
|
|
import xData from '../liquid-tags/data.js'
|
|
import xOcticon from '../liquid-tags/octicon.js'
|
|
import xLinkAsArticleCard from '../liquid-tags/link-as-article-card.js'
|
|
import xIfversion from '../liquid-tags/ifversion.js'
|
|
|
|
// Include custom tags like {% link_with_intro /article/foo %}
|
|
renderContent.liquid.registerTag('link', xLink('link'))
|
|
renderContent.liquid.registerTag('link_with_intro', xLinkWithIntro)
|
|
renderContent.liquid.registerTag('homepage_link_with_intro', xHomepageLinkWithIntro)
|
|
renderContent.liquid.registerTag('link_in_list', xLinkInList)
|
|
renderContent.liquid.registerTag('topic_link_in_list', xTopicLinkInList)
|
|
renderContent.liquid.registerTag('indented_data_reference', xIndentedDataReference)
|
|
renderContent.liquid.registerTag('data', xData)
|
|
renderContent.liquid.registerTag('octicon', xOcticon)
|
|
renderContent.liquid.registerTag('link_as_article_card', xLinkAsArticleCard)
|
|
renderContent.liquid.registerTag('ifversion', xIfversion)
|
|
|
|
for (const tag in tags) {
|
|
// Register all the extended markdown tags, like {% note %} and {% warning %}
|
|
renderContent.liquid.registerTag(tag, ExtendedMarkdown)
|
|
}
|
|
|
|
/**
|
|
* Like the `size` filter, but specifically for
|
|
* getting the number of keys in an object
|
|
*/
|
|
renderContent.liquid.registerFilter('obj_size', input => {
|
|
if (!input) return 0
|
|
return Object.keys(input).length
|
|
})
|
|
|
|
/**
|
|
* Returns the version number of a GHES version string
|
|
* ex: enterprise-server@2.22 => 2.22
|
|
*/
|
|
renderContent.liquid.registerFilter('version_num', input => {
|
|
return input.split('@')[1]
|
|
})
|
|
|
|
/**
|
|
* Convert the input to a slug
|
|
*/
|
|
renderContent.liquid.registerFilter('slugify', input => {
|
|
const slugger = new GithubSlugger()
|
|
return slugger.slug(input)
|
|
})
|
|
|
|
export default renderContent
|
|
|
|
export const liquid = renderContent.liquid
|