Skip to content

Commit

Permalink
Strip UTF-8 BOM from Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Aug 11, 2021
1 parent feeccb3 commit 7937d0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export interface ConvertResult {

export type ConvertedCallback = (result: ConvertResult) => void

const stripBOM = (s: string) => (s.charCodeAt(0) === 0xfeff ? s.slice(1) : s)

export class Converter {
readonly options: ConverterOption

Expand Down Expand Up @@ -149,7 +151,7 @@ export class Converter {
: undefined,
renderer: (tplOpts) => {
const engine = this.generateEngine(tplOpts)
const ret = engine.render(`${markdown}${additionals}`)
const ret = engine.render(stripBOM(`${markdown}${additionals}`))
const info = engine[engineInfo]

if (isFile(file))
Expand Down

0 comments on commit 7937d0a

Please sign in to comment.