- Notifications
You must be signed in to change notification settings - Fork6
Highlightjs Structured Text language support IEC 61131-3
License
highlightjs/highlightjs-structured-text
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository provides syntax highlighting for Highlight.js for Structured Text. ST is one of the 6 languages of IEC 61131-3 standard developed in 1998 for developing PLC programs.
We want to provide ST syntax highlights in VS Code Markdown editor and Markdown preview. And other cases when tutorials are published in the web.
npm i highlightjs-structured-text --saveInclude thehighlight.js script package in your webpage or node app, load this module and register it withhljs. Follow instructions athighlightjs to learn how to include the library and CSS.
If you're not using a build system and just want to embed this in your webpage:
<scripttype="text/javascript"src="/path/to/highlight.pack.js"></script><scripttype="text/javascript"src="/path/to/highlightjs-structured-text/dist/iecst.min.js"></script><scripttype="text/javascript">hljs.highlightAll();</script>
If you're using webpack / rollup / browserify / node:
varhljs=require('highlightjs');varhljsDefineIECST=require('highlightjs-structured-text');hljs.registerLanguage('iecst',hljsDefineIECST);hljs.initHighlightingOnLoad();
Mark the code you want to highlight with the iecst class:
<pre><codeclass="iecst">...</code></pre>
Or use JavaScript to programmatically highlight text string:
hljs.registerLanguage('iecst',hljsDefineIECST);varhighlighted=hljs.highlightAuto(text_string,["iecst"]);
importReact,{Component}from'react'import'highlight.js/scss/darcula.scss' #yourfavouritethemeimportcypherfrom'./iecst'importhljsfrom'highlight.js'hljs.registerLanguage('iecst',iecst);classHighlighterextendsComponent{constructor(props){super(props);hljs.initHighlightingOnLoad();}render(){let{children}=this.props;return{<preref={(node)=>this.node=node}><codeclassName="iecst">{children}</code></pre>}}}exportdefaultHighlighter;
To use inmarp
First create fileengine.js
const{ Marp}=require('@marp-team/marp-core')consthljs=require('highlight.js')constiecst=require('highlightjs-structured-text')hljs.registerLanguage("iecst",iecst)module.exports=(opts)=>{constmarp=newMarp(opts)marp.highlighter=(code,lang)=>{if(lang){returnhljs.getLanguage(lang) ?hljs.highlight(lang,code,true).value :''}returnhljs.highlightAuto(code).value}returnmarp}
And now when you build with CLI add engine parameter,
npx marp --engine ./enjine.js ./slides.md
About
Highlightjs Structured Text language support IEC 61131-3
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.