shell.js 743 B

123456789101112131415161718192021222324252627282930
  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: [ 'console' ],
  13. contains: [
  14. {
  15. className: 'meta',
  16. // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
  17. // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
  18. // echo /path/to/home > t.exe
  19. begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#]/,
  20. starts: {
  21. end: /[^\\](?=\s*$)/,
  22. subLanguage: 'bash'
  23. }
  24. }
  25. ]
  26. };
  27. }
  28. module.exports = shell;