Skip to content

Commit

Permalink
πŸ‘Œ Make field_list compatible with latest upstream (#75)
Browse files Browse the repository at this point in the history
executablebooks/markdown-it-py#270 deprecates  `srcCharCode` and makes it immutable.
  • Loading branch information
chrisjsewell committed Jun 1, 2023
1 parent 9cb9ff9 commit 2040839
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions mdit_py_plugins/field_list/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,11 @@ def _fieldlist_rule(state: StateBlock, startLine: int, endLine: int, silent: boo
# and replace the "hole" left with space,
# so that src indexes still match
diff = first_line_body_indent - block_indent
state._src = (
state.src = (
state.src[: contentStart - diff]
+ " " * diff
+ state.src[contentStart:]
)
state.srcCharCode = (
state.srcCharCode[: contentStart - diff]
+ tuple([0x20] * diff)
+ state.srcCharCode[contentStart:]
)

state.tShift[startLine] = contentStart - diff - state.bMarks[startLine]
state.sCount[startLine] = first_line_body_indent - diff
Expand Down Expand Up @@ -249,11 +244,9 @@ def temp_state_changes(state: StateBlock, startLine: int):
oldTShift = state.tShift[startLine]
oldSCount = state.sCount[startLine]
oldBlkIndent = state.blkIndent
oldSrc = state._src
oldSrcCharCode = state.srcCharCode
oldSrc = state.src
yield
state.blkIndent = oldBlkIndent
state.tShift[startLine] = oldTShift
state.sCount[startLine] = oldSCount
state._src = oldSrc
state.srcCharCode = oldSrcCharCode
state.src = oldSrc

0 comments on commit 2040839

Please sign in to comment.