feat: implement custom comment syntax
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import sys
|
||||
|
||||
import mistletoe
|
||||
from fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(sys.argv[1]) as fin, open(sys.argv[2], "w") as fout:
|
||||
fout.write(mistletoe.markdown(fin, FiftyOhmHtmlRenderer))
|
||||
@@ -0,0 +1,21 @@
|
||||
from mistletoe import HtmlRenderer
|
||||
from mistletoe.block_token import BlockToken
|
||||
|
||||
|
||||
class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
def __init__(self):
|
||||
super().__init__(Comment)
|
||||
|
||||
def render_comment():
|
||||
return None
|
||||
|
||||
|
||||
class Comment(BlockToken):
|
||||
@staticmethod
|
||||
def start(line):
|
||||
return line.startswith("%")
|
||||
|
||||
@classmethod
|
||||
def read(cls, lines):
|
||||
next(lines)
|
||||
return None
|
||||
Reference in New Issue
Block a user