MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / isValidEntityCode

Function isValidEntityCode

markdown_it/common/utils.py:56–75  ·  view source on GitHub ↗
(c: int)

Source from the content-addressed store, hash-verified

54
55
56def isValidEntityCode(c: int) -> bool:
57 # broken sequence
58 if c >= 0xD800 and c <= 0xDFFF:
59 return False
60 # never used
61 if c >= 0xFDD0 and c <= 0xFDEF:
62 return False
63 if ((c & 0xFFFF) == 0xFFFF) or ((c & 0xFFFF) == 0xFFFE):
64 return False
65 # control codes
66 if c >= 0x00 and c <= 0x08:
67 return False
68 if c == 0x0B:
69 return False
70 if c >= 0x0E and c <= 0x1F:
71 return False
72 if c >= 0x7F and c <= 0x9F:
73 return False
74 # out of range
75 return not (c > 0x10FFFF)
76
77
78def fromCodePoint(c: int) -> str:

Callers 2

entityFunction · 0.85
replaceEntityPatternFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…