1"use strict";(self.webpackChunkmarkuplint_website=self.webpackChunkmarkuplint_website||[]).push([[9724],{4414(e,n,i){i.r(n),i.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>x,frontMatter:()=>d,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"migration/v4-to-v5/api","title":"API","description":"markuplint no longer re-exports the v1 exec() helper (export * from \'./v1.js\' in v4). Use MLEngine (or lint where you already do).","source":"@site/docs/migration/v4-to-v5/api.md","sourceDirName":"migration/v4-to-v5","slug":"/migration/v4-to-v5/api","permalink":"/docs/migration/v4-to-v5/api","draft":false,"unlisted":false,"editUrl":"https://github.com/markuplint/markuplint/edit/main/website/docs/migration/v4-to-v5/api.md","tags":[],"version":"current","sidebarPosition":7,"frontMatter":{"sidebar_position":7,"title":"API"},"sidebar":"migration","previous":{"title":"Rule Fix Function","permalink":"/docs/migration/v4-to-v5/rule-fix-function"},"next":{"title":"AST","permalink":"/docs/migration/v4-to-v5/ast"}}');var s=i(4848),t=i(8453);const d={sidebar_position:7,title:"API"},o="API",c={},l=[{value:"<code>FixSummary</code>",id:"fixsummary",level:2}];function h(e){const n={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,t.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"api",children:"API"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"markuplint"})," no longer re-exports the v1 ",(0,s.jsx)(n.code,{children:"exec()"})," helper (",(0,s.jsx)(n.code,{children:"export * from './v1.js'"})," in v4). Use ",(0,s.jsx)(n.code,{children:"MLEngine"})," (or ",(0,s.jsx)(n.code,{children:"lint"})," where you already do)."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:"import { MLEngine } from 'markuplint';\n\nconst file = await MLEngine.toMLFile('index.html');\nconst engine = new MLEngine(file, { configFile: '.markuplintrc' });\nconst result = await engine.exec();\n"})}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.th,{children:["v1 ",(0,s.jsx)(n.code,{children:"exec()"})," option"]}),(0,s.jsx)(n.th,{children:"v5"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"files"})}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"MLEngine.toMLFile()"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(n.code,{children:"sourceCodes"})," / ",(0,s.jsx)(n.code,{children:"names"})," / ",(0,s.jsx)(n.code,{children:"workspace"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"MLEngine.toMLFile({ sourceCode, name, workspace })"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(n.code,{children:"config"})," string"]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"configFile"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:[(0,s.jsx)(n.code,{children:"config"})," object"]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"config"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"defaultConfig"})}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"defaultConfig"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"rules"})}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"rules"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"rulesAutoResolve"})}),(0,s.jsx)(n.td,{children:"Always on; option removed"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"fix"})}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"fix"})})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"locale"})}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.code,{children:"locale"})})]})]})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"APIOptions.autoLoad"})," is removed; rules are always loaded."]}),"\n",(0,s.jsxs)(n.p,{children:["Removed types/helpers: ",(0,s.jsx)(n.code,{children:"MLResultInfo_v1"}),"; ",(0,s.jsx)(n.code,{children:"getIndent()"})," from ",(0,s.jsx)(n.code,{children:"@markuplint/ml-core"}),"; ",(0,s.jsx)(n.code,{children:"Token.getLine"})," / ",(0,s.jsx)(n.code,{children:"Token.getCol"})," from ",(0,s.jsx)(n.code,{children:"@markuplint/types"})," (use ",(0,s.jsx)(n.code,{children:"Token.getPosition"}),"); ",(0,s.jsx)(n.code,{children:"getLine"})," / ",(0,s.jsx)(n.code,{children:"getCol"})," from ",(0,s.jsx)(n.code,{children:"@markuplint/parser-utils"})," (use ",(0,s.jsx)(n.code,{children:"getPosition"}),")."]}),"\n",(0,s.jsx)(n.h2,{id:"fixsummary",children:(0,s.jsx)(n.code,{children:"FixSummary"})}),"\n",(0,s.jsxs)(n.p,{children:["With ",(0,s.jsx)(n.code,{children:"fix: true"}),", ",(0,s.jsx)(n.code,{children:"MLResultInfo.fixSummary"})," reports pass counts and remaining violations. Top-level ",(0,s.jsx)(n.code,{children:"violations"})," is the first pass. After fix, use ",(0,s.jsx)(n.code,{children:"fixSummary.finalPassViolations ?? violations"}),"."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"computeCursorOffset"})," is exported from ",(0,s.jsx)(n.code,{children:"@markuplint/ml-core"})," to map a cursor through ",(0,s.jsx)(n.code,{children:"fixSummary.firstPassEdits"}),"."]})]})}function x(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},8453(e,n,i){i.d(n,{R:()=>d,x:()=>o});var r=i(6540);const s={},t=r.createContext(s);function d(e){const n=r.useContext(t);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:d(e.components),r.createElement(t.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.