Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Highlightjs Structured Text language support IEC 61131-3

License

NotificationsYou must be signed in to change notification settings

highlightjs/highlightjs-structured-text

Repository files navigation

Greenkeeper badge

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.

Install

npm i highlightjs-structured-text --save

Usage

Browser

Include 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>

Nodejs

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>

Programmatically

Or use JavaScript to programmatically highlight text string:

hljs.registerLanguage('iecst',hljsDefineIECST);varhighlighted=hljs.highlightAuto(text_string,["iecst"]);

React

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;

Marp

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

Stars

Watchers

Forks

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp