mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
Add 'yarn lint' command and run it in GH actions (#517)
* Add 'yarn lint' command and run it in GH actions * Move linting to own workflow * Remove linting from build-workflow * Solve linting warnings Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
f665d047dc
commit
84df2ea1cf
7 changed files with 38 additions and 8 deletions
|
@ -0,0 +1,16 @@
|
|||
import MarkdownIt from 'markdown-it'
|
||||
import Renderer from 'markdown-it/lib/renderer'
|
||||
import Token from 'markdown-it/lib/token'
|
||||
|
||||
type RenderContainerReturn = (tokens: Token[], index: number, options: MarkdownIt.Options, env: unknown, self: Renderer) => void;
|
||||
type ValidAlertLevels = ('warning' | 'danger' | 'success' | 'info')
|
||||
export const validAlertLevels: ValidAlertLevels[] = ['success', 'danger', 'info', 'warning']
|
||||
|
||||
export const createRenderContainer = (level: ValidAlertLevels): RenderContainerReturn => {
|
||||
return (tokens: Token[], index: number, options: MarkdownIt.Options, env: unknown, self: Renderer) => {
|
||||
tokens[index].attrJoin('role', 'alert')
|
||||
tokens[index].attrJoin('class', 'alert')
|
||||
tokens[index].attrJoin('class', `alert-${level}`)
|
||||
return self.renderToken(tokens, index, options)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue