Testing Code Syntax Highlighting
Test Syntax
I am wondering how easy to add syntax and make the syntax highlighted in Ghost. Its super easy, we can just type "```" and then spacebar. Syntax box will appears!
But, the syntax you get will not colorful. To get the syntax highlight you need some extra work, add prism library to Code Injection in Ghost admin panel.
Cisco IOS Syntax
router1# config t
router1(config)# hostname R1
YAML Syntax
---
- name: IP Helper Playbook
hosts: #CiscoSW2
- CiscoSW2
- CiscoSW3
#- CiscoSW4
gather_facts: false
tasks:
- name: run show run-config
ios_command:
commands: show running-config
register: output
Python Syntax
#!/usr/bin/python
from ciscoconfparse import CiscoConfParse
from ansible.module_utils.basic import AnsibleModule
def find_sections(**kwargs):
parse = CiscoConfParse(kwargs['lines'])
if kwargs['child_match'] == 'any':
found_objs = parse.find_objects(kwargs['match'])
else:
if kwargs['children_that_match']:
found_objs = parse.find_objects_w_child(parentspec=r"%s" % kwargs['match'],
childspec=r"%s" % kwargs['child_match'])
else:
found_objs = parse.find_objects_wo_child(parentspec=r"%s" % kwargs['match'],
childspec=r"%s" % kwargs['child_match'])
PowerShell Syntax
PS C:\Users\iqbalm> Get-Date
Friday, October 30, 2020 3:22:38 PM
The most use in my future blog is CLI, YAML, Python and PowerShell syntax which is shown perfectly nice above. Have a nice day!