Newbie of 2-days: using HTML blocks (custom attributes discarded)

I was trying to render some markdown and html together. It appears the HTML elements with custom attrs have the custom attrs STRIPPED away (based on looking in the web-inspector).

Q: Is that documented or expected behavior for the Obsidian markdown renderer?

I posted yesterday on the topic of HTML and markdown interleaving. Today I am trying to discover what HTML capabilities Obsidian supports.

To that end I was trying to build any form of markdown page that supports more than one flow/section on the page. To do that I used custom css snippet and shifted the main view right to make space and then fixed position moved my left html elements (trivialized sections) into place. There are many ways to do these kind of layouts in css, but Obsidian appears to impose some strict constraints on what is possible.

I am trying to learn if any of these types of patterns are possible in Obsidian’s markdown implementation.

Thank you for any advice or explanations :bowing_man:

SOURCE TO TRY - BELOW

my.css snippet

div.md-left-sidebar.markdown-preview-view {
  margin-left: 20em;
}

.md-left-sidebar.markdown-preview-view table {
  position: fixed;
  top: 4em; left: 2em;
  background-color: yellow;
}
.md-left-sidebar.markdown-preview-view span {
  position: fixed;
  top: 14em; left: 2em;
  background-color: yellow;
}
.md-left-sidebar.markdown-preview-view [x-md] {
  position: fixed;
  top: 18em; left: 2em;
  background-color: yellow;
}

SidebarExample.md

---
cssclass: md-left-sidebar
---

# main header

Content here

| sidebar|
| ---- |
| markdown - (appears unsupported)|

## section

<div markdown=1 x-md>
markdown in a `div` with a [link](http://127.0.0.1) here.
</div>

<span markdown=1 x-md>
markdown in a `span` with a [link](http://127.0.0.1) here.
</span>

Is Obsidian using turndown?

if so, is it possible to use a customized turndown within Obsidian?

Two community plugins generate multi-column layouts. Maybe you can see how they accomplish the CSS?

  1. Obsidian columns

  2. Multi-column markdown

1 Like

Obsidian uses CodeMirror 6 (CM6) to power the Markdown editor.

:raised_hands::bowing_man:

Thank you. That was an excellent breadcrumb.

It gave me the Obsidian design pattern hint as to how the view can be post render modified.

it also led me to reading the plug-in samples, plug-in guide, CodeMirror guide, and fenced code block patterns and implementation internals as well as the (millions of lines moving window) parsing performance rationale.

it’s not my ideal html+md interleaved standards solution; but with plug-in work what I want to achieve is one-off plug-in possible each time.

in effect, a named-class fenced code block can be used as a custom html element. the plug-in named-class handler can then process the fenced block as “html+markdown” and post process expand it and decorate the DOM tree appropriately.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.