
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
roku-markdown
Advanced tools
This is a simple markdown renderer for Roku apps written in BrighterScript.
Parser and renderer support a subset of the markdown spec, and strip all inline styles. The goal is to eventually support images between paragraphs.
There is currently no plan to support full text styling, but might consider tables.
Current support:
# Title
syntax> That quote
-=*
ropm install roku-markdown
Suggestion: use a shorter prefix:
ropm install md@npm:roku-markdown
See demo.bs
in the repository sources for an example of usage.
Following example use unprefixed installation. Replace rokumarkdown_
with md_
if you used the prefix as suggested.
<rokumarkdown_Renderer id="markdownView" />
You can redefine some/all the fonts and colors/alignments:
<rokumarkdown_Renderer id="markdownView" color="#FFFFCC" h1Align="center">
<Font role="font" uri="pkg:/fonts/Ubuntu_Regular.ttf" size="24" />
<Font role="h1Font" uri="pkg:/fonts/Ubuntu_Bold.ttf" size="48" />
<Font role="h2Font" uri="pkg:/fonts/Ubuntu_Bold.ttf" size="36" />
</rokumarkdown_Renderer>
Full interface:
<interface>
<field id="width" type="int" />
<field id="height" type="int" />
<field id="padding" type="array" />
<field id="itemSpacing" type="int" />
<field id="font" type="node" />
<field id="color" type="string" />
<field id="align" type="string" />
<field id="quoteFont" type="node" />
<field id="quoteColor" type="string" />
<field id="quoteAlign" type="string" />
<field id="quotePadding" type="array" />
<field id="quoteBackground" type="string" />
<field id="codeFont" type="node" />
<field id="codeColor" type="string" />
<field id="codeAlign" type="string" />
<field id="codePadding" type="array" />
<field id="codeBackground" type="string" />
<field id="h1Font" type="node" />
<field id="h1Color" type="string" />
<field id="h1Align" type="string" />
<field id="h2Font" type="node" />
<field id="h2Color" type="string" />
<field id="h2Align" type="string" />
<field id="h3Font" type="node" />
<field id="h3Color" type="string" />
<field id="h3Align" type="string" />
<field id="h4Font" type="node" />
<field id="h4Color" type="string" />
<field id="h4Align" type="string" />
<field id="hrColor" type="string" />
<field id="hrSize" type="int" />
<field id="animatedScrolling" type="boolean" alias="scroller.animatedScrolling" />
<field id="scrollFraction" type="integer" alias="scroller.scrollFraction" />
<field id="scrollRatio" type="integer" alias="scroller.scrollRatio" />
<field id="overflows" type="boolean" />
<function name="render" />
</interface>
Paddings are arrays of numbers following CSS rules:
[all]
[top-bottom, right-left]
[top, right, bottom, left]
Colors are Roku RRGGBB or RRGGBBAA color string, e.g. "#FFFFFF33"
Backgrounds are:
"#FFFFFF33"
,size
field ([width, height]
), and the text label is appended as a child (see demo).Alignments are Label horizontal alignement values (left|center|right
)
Titles after H4 are all rendered as H4.
Vanilla BrightScript version
parser = rokumarkdown_Parser()
data = parser.parse(markdownSrc)
view = m.top.findNode("markdownView")
view.callfunc("render", data)
' view is scrollable and can be focused
view.setFocus(true)
If you want an optimised non-interactive clipped render:
view.callfunc("render", data, false)
' view isn't scrollable anymore
BrighterScript version
parser = new rokumarkdown_Parser()
data = parser.parse(markdownSrc)
view = m.top.findNode("markdownView")
view@.render(data)
' view is scrollable and can be focused
view.setFocus(true)
If you want an optimised non-interactive clipped render:
view@.render(data, false)
' view isn't scrollable anymore
This component will not render a scrollbar:
overflows
tells whether the content is bigger than the view,scrollFraction
to know the state of the scrolling,scrollRatio
to know how much of the content is visible VS hidden.See the repository demo for an example rendering a scrollbar.
npm install
/dist
)
npm run build
This repository comes pre-configured to work with the BrightScript Language extension for Visual Studio Code. So once you have that plugin installed, debugging your project is as simple as clicking the "Start Debugging" button.
FAQs
Markdown parser/renderer for Roku apps
The npm package roku-markdown receives a total of 2 weekly downloads. As such, roku-markdown popularity was classified as not popular.
We found that roku-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.