Replies: 2 comments
-
Currently the only way is to build the hierarchical data structure by yourself, with custom HTML as It seems fascinating if we can support components inside markmap, which might be a feature in the future. |
Beta Was this translation helpful? Give feedback.
-
I stumbled on a hack for this in the meantime. If I have a list item in markdown, I can add some HTML tags inline in the markdown text for it to be rendered. As long as it's something that doesn't create a container (div, button, etc) it'll render fine. If it's a container, you end up with the div for the normal foreignObject with Link anchors don't do that, so you could style a link to look like a button, or just use a link to trigger javascript. So for example, I can have this in my markdown: ### Inline HTML
- You can use tags like `<br>`<br>to add line breaks
- You can use tags like `<b></b>` to `<b>bold</b> or <i>italicize</i>
- These can be combined to make headers
- <b>Header</b><br>text<br>text
- Don't try adding `<div>` blocks as it does not render well
- <a href="#" class="link-button" onclick="myFunction()">Button Example</a> Then earlier in my inline .link-button {
background-color: #aaaaaa;
color: black;
padding: 15px 25px;
text-decoration: none;
border: 1px black;
}
.link-button:hover {
background-color: #555555;
} And later before closing the body I add the javascript for the link function: <script>
function myFunction() {
alert('You rang?');
return false;
}
</script> The only reason I was doing the styles inline vs CSS was because my use case was a MacOS/iOS shortcut that takes in markdown, then generates a static local HTML page to feed into Safari locally after I add the script source tags to markmap. So I needed everything to be self-contained. |
Beta Was this translation helpful? Give feedback.
-
I want to render the text in a button, such as when clicking the button I can implement some functionality, do you think it's possible?
Beta Was this translation helpful? Give feedback.
All reactions