Class: Markdowndocs::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/markdowndocs/configuration.rb

Constant Summary collapse

RESERVED_MODE_NAMES =

Route segments owned by the engine itself. A mode name matching any of these would collide with built-in routes / controller actions.

%w[search_index preference preferences].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/markdowndocs/configuration.rb', line 19

def initialize
  @docs_path = nil # Resolved lazily so Rails.root is available
  @categories = {}
  self.modes = %w[guide technical]
  @default_mode = "guide"
  @markdown_options = default_markdown_options
  @rouge_theme = "github"
  @cache_expiry = 1.hour
  @user_mode_resolver = nil
  @user_mode_saver = nil
  @search_enabled = false
  @layout = "markdowndocs/application"
  # Opt-in: allow a curated, safe inline-SVG subset in rendered docs.
  # When true, the renderer passes raw HTML through commonmarker (unsafe)
  # and the sanitizer (the security boundary) whitelists structural SVG
  # tags/attributes while still stripping scripts/handlers. Default off.
  @allow_svg = false
  @non_mode_subdirs_warned = Set.new
  @audience_deprecation_emitted = Set.new
end

Instance Attribute Details

#allow_svgObject

Returns the value of attribute allow_svg.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def allow_svg
  @allow_svg
end

#audience_deprecation_emittedObject (readonly)

Returns the value of attribute audience_deprecation_emitted.



13
14
15
# File 'lib/markdowndocs/configuration.rb', line 13

def audience_deprecation_emitted
  @audience_deprecation_emitted
end

#cache_expiryObject

Returns the value of attribute cache_expiry.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def cache_expiry
  @cache_expiry
end

#categoriesObject

Returns the value of attribute categories.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def categories
  @categories
end

#default_modeObject

Returns the value of attribute default_mode.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def default_mode
  @default_mode
end

#docs_pathObject

Returns the value of attribute docs_path.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def docs_path
  @docs_path
end

#layoutObject

Returns the value of attribute layout.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def layout
  @layout
end

#markdown_optionsObject

Returns the value of attribute markdown_options.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def markdown_options
  @markdown_options
end

#modesObject

Returns the value of attribute modes.



13
14
15
# File 'lib/markdowndocs/configuration.rb', line 13

def modes
  @modes
end

#non_mode_subdirs_warnedObject (readonly)

Returns the value of attribute non_mode_subdirs_warned.



13
14
15
# File 'lib/markdowndocs/configuration.rb', line 13

def non_mode_subdirs_warned
  @non_mode_subdirs_warned
end

#rouge_themeObject

Returns the value of attribute rouge_theme.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def rouge_theme
  @rouge_theme
end

#search_enabledObject

Returns the value of attribute search_enabled.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def search_enabled
  @search_enabled
end

#user_mode_resolverObject

Returns the value of attribute user_mode_resolver.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def user_mode_resolver
  @user_mode_resolver
end

#user_mode_saverObject

Returns the value of attribute user_mode_saver.



9
10
11
# File 'lib/markdowndocs/configuration.rb', line 9

def user_mode_saver
  @user_mode_saver
end

Instance Method Details

#resolved_docs_pathObject

Lazily resolve docs_path so Rails.root is available



41
42
43
# File 'lib/markdowndocs/configuration.rb', line 41

def resolved_docs_path
  @docs_path || Rails.root.join("app", "docs")
end