codekingpro/portable-devtools
114k
1- package: markdown-it/markdown-it2 version: 14.1.03 commit: 0fe7ccb4b7f30236fb05f623be6924961d296d3d4 date: Mar 19, 20245 notes:6 - Rename variables that use python built-in names, e.g.7 - `max` -> `maximum`8 - `len` -> `length`9 - `str` -> `string`10 - |11 Convert JS `for` loops to `while` loops12 this is generally the main difference between the codes,13 because in python you can't do e.g. `for {i=1;i<x;i++} {}`14 - |15 `env` is a common Python dictionary, and so does not have attribute access to keys,16 as with JavaScript dictionaries.17 `options` have attribute access only to core markdownit configuration options18 - |19 `Token.attrs` is a dictionary, instead of a list of lists.20 Upstream the list format is only used to guarantee order: https://github.com/markdown-it/markdown-it/issues/142,21 but in Python 3.7+ order of dictionaries is guaranteed.22 One should anyhow use the `attrGet`, `attrSet`, `attrPush` and `attrJoin` methods23 to manipulate `Token.attrs`, which have an identical signature to those upstream.24 - Use python version of `charCodeAt`25 - |26 Use `str` units instead of `int`s to represent Unicode codepoints.27 This provides a significant performance boost28 - |29 In markdown_it/rules_block/reference.py,30 record line range in state.env["references"] and add state.env["duplicate_refs"]31 This is to allow renderers to report on issues regarding references32 - |33 The `MarkdownIt.__init__` signature is slightly different for updating options,34 since you must always specify the config first, e.g.35 use `MarkdownIt("commonmark", {"html": False})` instead of `MarkdownIt({"html": False})`36 - The default configuration preset for `MarkdownIt` is "commonmark" not "default"37 - Allow custom renderer to be passed to `MarkdownIt`38 - |39 change render method signatures40 `func(tokens, idx, options, env, slf)` to41 `func(self, tokens, idx, options, env)`42 - |43 Extensions add render methods by format44 `MarkdownIt.add_render_rule(name, function, fmt="html")`,45 rather than `MarkdownIt.renderer.rules[name] = function`46 and renderers should declare a class property `__output__ = "html"`.47 This allows for extensibility to more than just HTML renderers48 - inline tokens in tables are assigned a map (this is helpful for propagation to children)49 