Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions core/Parsers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ let dartdoc : ContentParser -> ContentParser =

let dartdoc_markdown ctx = dartdoc markdown_noHeader ctx

/// ESLint configuration comments parser that prevents wrapping of eslint-disable lines
/// https://github.com/dnut/Rewrap/issues/33
let eslintConfigComments : ContentParser -> ContentParser =
fun content ctx ->

let rx = regex @"^\s*//\s*eslint-(disable-next-line|disable-line)"

fun line ->
if isMatch rx line then
finished_ line noWrapBlock
else
content ctx line

let ignoreAll ctx = Parsing_Internal.ignoreAll ctx

let godoc : ContentParser = fun _ctx ->
Expand Down
7 changes: 5 additions & 2 deletions core/Parsing.Documents.fs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ let private configFile = sc [line "#"]
let java : DocumentProcessor =
sc [ jsDocBlock; cBlock; line' "//[/!]" jsdoc_markdown; line "//" ]

let javascript : DocumentProcessor =
sc [ jsDocBlock; cBlock; line' "//[/!]" (eslintConfigComments jsdoc_markdown); line "//" ]

// Takes 4 args to create a Language:
// 1. display name (used only in VS)
// 2. string of aliases (language IDs used by the client. Not needed if they only differ
Expand Down Expand Up @@ -129,7 +132,7 @@ let mutable languages = [
lang "INI" "" ".ini" <| sc [line "[#;]"]
lang "J" "" ".ijs" <| sc [line @"NB\."]
lang "Java" "" ".java" java
lang "JavaScript" "javascriptreact|js" ".js|.jsx" java
lang "JavaScript" "javascriptreact|js" ".js|.jsx" javascript
lang "Julia" "" ".jl" <| sc [block ("#=", "=#"); line "#"; block (@".*?""""""", "\"\"\"")]
lang "JSON" "json5|jsonc" ".json|.json5|.jsonc" java
lang "LaTeX" "tex" ".bbx|.cbx|.cls|.sty|.tex"
Expand Down Expand Up @@ -182,7 +185,7 @@ let mutable languages = [
lang "Tcl" "" ".tcl" <| configFile
lang "Textile" "" ".textile" <| docOf markdown
lang "TOML" "" ".toml" <| configFile
lang "TypeScript" "typescriptreact" ".ts|.tsx" java
lang "TypeScript" "typescriptreact" ".ts|.tsx" javascript
lang "Verilog/SystemVerilog" "systemverilog|verilog" ".sv|.svh|.v|.vh|.vl" java
lang "XAML" "" ".xaml"
html
Expand Down