-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The current parsing style for the content of the terminal can only support concentrated commands within the hexo tag arguments, which decreases readability and functionality as these commands are merely separated by a semicolon inline.
Modifications to the parsing style could avoid these disabilities by adding specific identifiers like $
within the tag itself.
For instance, the current style for tags
{% gdemo_terminal 'node ./demo' '250px' 'bash' '500' '$' 'demo-teriminal' %}
Hello World!
{% endgdemo_terminal %}
could be modified into the following
{% gdemo_terminal '' '250px' 'bash' '500' '$' 'demo-teriminal' %}
$ node ./demo
Hello World!
{% endgdemo_terminal %}
and the parser could recognize the $
at the beginning of the commands.
In this way the terminal can support multi-output for different commands. e.g.
{% gdemo_terminal '' '250px' 'bash' '500' '$' 'demo-teriminal' %}
$ node ./demo
Hello World!
$ cat .gitignore
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/
{% endgdemo_terminal %}
Further modifications could support multi-line commands by forcing users to explicitly add ;
to the end of commands so that the parser could identify the end of commands and beginning of outputs.
These identifiers above could also be able to be modified by users using the _config.yml file using formats similar to the following:
gdemo:
terminal:
command_id: '$'
command_end: ';'
Backwards compatibility can be added by still supporting the current inline command style when included, parsing using the style mentioned above only when the user enters an empty string for the command
argument.