Add markup rendering and basic styling.
This commit is contained in:
parent
f174be032e
commit
90d1c15ba7
@ -601,8 +601,22 @@ def render_text_tokens(tokens, acc, headline, graph):
|
||||
except NonExistingLocalNoteError as err:
|
||||
logging.warning(err.get_message())
|
||||
acc.append(html.escape(description))
|
||||
# else:
|
||||
# raise NotImplementedError('TextToken: {}'.format(chunk))
|
||||
elif isinstance(chunk, org_rw.MarkerToken):
|
||||
tag = '<'
|
||||
if chunk.closing:
|
||||
tag += '/'
|
||||
tag += {
|
||||
org_rw.MarkerType.BOLD_MODE: 'strong',
|
||||
org_rw.MarkerType.CODE_MODE: 'code',
|
||||
org_rw.MarkerType.ITALIC_MODE: 'em',
|
||||
org_rw.MarkerType.STRIKE_MODE: 's',
|
||||
org_rw.MarkerType.UNDERLINED_MODE: 'span class="underlined"' if not chunk.closing else 'span',
|
||||
org_rw.MarkerType.VERBATIM_MODE: 'span class="verbatim"' if not chunk.closing else 'span',
|
||||
}[chunk.tok_type]
|
||||
tag += '>'
|
||||
acc.append(tag)
|
||||
else:
|
||||
raise NotImplementedError('TextToken: {}'.format(chunk))
|
||||
acc.append('</p>')
|
||||
|
||||
|
||||
|
@ -340,6 +340,11 @@ a.internal::after {
|
||||
content: ' }';
|
||||
}
|
||||
|
||||
/* Markup */
|
||||
.underlined {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre {
|
||||
overflow: auto;
|
||||
@ -366,7 +371,7 @@ pre code {
|
||||
padding: 0.5ex;
|
||||
}
|
||||
|
||||
code {
|
||||
code, .verbatim {
|
||||
padding: 0.25ex 0.5ex;
|
||||
margin: 0.25ex;
|
||||
background: #eee;
|
||||
@ -542,7 +547,7 @@ tr.__table-separator {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
code {
|
||||
code, .verbatim {
|
||||
background: #262826;
|
||||
color: #FFF;
|
||||
font-family: Menlo, Monaco, "Courier New", monospace;
|
||||
|
Loading…
Reference in New Issue
Block a user