Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

index.js 1.8 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  1. const GithubSlugger = require('github-slugger')
  2. const renderContent = require('./renderContent')
  3. const { ExtendedMarkdown, tags } = require('../liquid-tags/extended-markdown')
  4. // Include custom tags like {% link_with_intro /article/foo %}
  5. renderContent.liquid.registerTag('link', require('../liquid-tags/link')('link'))
  6. renderContent.liquid.registerTag('link_with_intro', require('../liquid-tags/link-with-intro'))
  7. renderContent.liquid.registerTag('homepage_link_with_intro', require('../liquid-tags/homepage-link-with-intro'))
  8. renderContent.liquid.registerTag('link_in_list', require('../liquid-tags/link-in-list'))
  9. renderContent.liquid.registerTag('topic_link_in_list', require('../liquid-tags/topic-link-in-list'))
  10. renderContent.liquid.registerTag('indented_data_reference', require('../liquid-tags/indented-data-reference'))
  11. renderContent.liquid.registerTag('data', require('../liquid-tags/data'))
  12. renderContent.liquid.registerTag('octicon', require('../liquid-tags/octicon'))
  13. renderContent.liquid.registerTag('link_as_article_card', require('../liquid-tags/link-as-article-card'))
  14. for (const tag in tags) {
  15. // Register all the extended markdown tags, like {% note %} and {% warning %}
  16. renderContent.liquid.registerTag(tag, ExtendedMarkdown)
  17. }
  18. /**
  19. * Like the `size` filter, but specifically for
  20. * getting the number of keys in an object
  21. */
  22. renderContent.liquid.registerFilter('obj_size', input => {
  23. if (!input) return 0
  24. return Object.keys(input).length
  25. })
  26. /**
  27. * Returns the version number of a GHES version string
  28. * ex: enterprise-server@2.22 => 2.22
  29. */
  30. renderContent.liquid.registerFilter('version_num', input => {
  31. return input.split('@')[1]
  32. })
  33. /**
  34. * Convert the input to a slug
  35. */
  36. renderContent.liquid.registerFilter('slugify', input => {
  37. const slugger = new GithubSlugger()
  38. return slugger.slug(input)
  39. })
  40. module.exports = renderContent
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...