Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A Python package aimed to simplify the processing of the mobiledoc format.
add_markdown_from_html()
method.pip install mobiledoc
PyPi
from mobiledoc import Mobiledoc
import json
mobiledoc = Mobiledoc()
mobiledoc.add_basic_text("This is a basic text, which is not formatted.")
mobiledoc.add_basic_text(["You may also add a list of strings.", "To add multiple paragraphs."])
mobiledoc.add_divider() # add a divider
mobiledoc.add_formatted_text("Using **markdown-like** syntax, you can *format* the text.")
mobiledoc.add_formatted_text(["You may also add a `list of strings`.", "To ^add^ ^^multiple^^ paragraphs.",
"You can also add [hyperlinks](https://python.org)."])
mobiledoc = mobiledoc.serialize() # This will save the mobiledoc as a dictionary
with open('doc.json', 'w') as f:
json.dump(mobiledoc, f, indent=4) # check out the doc.json file to see the mobiledoc just created!
This will create redy-to-use mobiledoc like below. (click expand to see the mobiledoc)
{
"version": "0.3.2",
"markups": [
["b"],
["i"],
["code"],
["sub"],
["sup"],
["a", ["href", "https://python.org"]]
],
"atoms": [],
"cards": [
["hr", {}]
],
"sections": [
[1, "p", [
[0, [], 0, "This is a basic text, which is not formatted."]
]],
[1, "p", [
[0, [], 0, "You may also add a list of strings."]
]],
[1, "p", [
[0, [], 0, "To add multiple paragraphs."]
]],
[10, 0],
[1, "p", [
[0, [], 0, "Using "],
[0, [0], 1, "markdown-like"],
[0, [], 0, " syntax, you can "],
[0, [1], 1, "format"],
[0, [], 0, " the text."]
]],
[1, "p", [
[0, [], 0, "You may also add a "],
[0, [2], 1, "list of strings"],
[0, [], 0, "."]
]],
[1, "p", [
[0, [], 0, "To "],
[0, [3], 1, "add"],
[0, [], 0, " "],
[0, [4], 1, "multiple"],
[0, [], 0, " paragraphs."]
]],
[1, "p", [
[0, [], 0, "You can also add "],
[0, [5], 1, "hyperlinks"],
[0, [], 0, "."]
]]
]
}
add_basic_text(text: Union[str, List[str]])
: Adds basic text to mobiledoc.
add_formatted_text(text: Union[str, List[str]])
: Adds markdown-like formatted text to mobiledoc.
**: bold
*: italic
~~: strikethrough
^^: superscript
^: subscript
__: underline
`: code
[text](link): hyperlink
add_divider()
: Adds a divider to mobiledoc.
add_image(url: str, caption: str = None)
: Adds an image to mobiledoc.
add_button(text: str, url: str, alignment:str = "center")
: Adds a button to mobiledoc.
add_HTML(self, html:str):
: Adds raw HTML card to mobiledoc.
add_markdown(self, markdown:str):
: Adds raw markdown card to mobiledoc.
add_file(self, url: str, filename: str, filetitle: str, filesize: int, filecaption: str = ""):
: Adds a file to mobiledoc.
add_callout(self, text: str, emoji: str = "", color: str = "accent"):
: Adds a callout to mobiledoc.
add_markdown_from_html(html_string: str):
: Adds markdown from HTML to mobiledoc.
custom_data(name: str, value)
: Adds custom data to mobiledoc.
serialize()
: Returns the serialized mobiledoc Python dictionary that can be passed to json.dump()
.get_markups()
: Returns the current markups.get_sections()
: Returns the current sections.get_atoms()
: Returns the current atoms.get_cards()
: Returns the current cards.get_custom()
: Returns the current custom data.Contributions are welcome! Please submit a pull request or open an issue on GitHub.
I hope this README provides a clear overview of the mobiledoc
package. You can further customize it as per your needs!
FAQs
A Python package aimed to simplify the processing of the mobiledoc format.
We found that mobiledoc demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.