shell.js 791 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. Language: Shell Session
  3. Requires: bash.js
  4. Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
  5. Category: common
  6. Audit: 2020
  7. */
  8. /** @type LanguageFn */
  9. function shell(hljs) {
  10. return {
  11. name: 'Shell Session',
  12. aliases: [
  13. 'console',
  14. 'shellsession'
  15. ],
  16. contains: [
  17. {
  18. className: 'meta.prompt',
  19. // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
  20. // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
  21. // echo /path/to/home > t.exe
  22. begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,
  23. starts: {
  24. end: /[^\\](?=\s*$)/,
  25. subLanguage: 'bash'
  26. }
  27. }
  28. ]
  29. };
  30. }
  31. export { shell as default };